Iframe cross-domain problem

use iframe to reference external links
< iframe: src= "url" id= "iframes" frameborder= "0" style= "width:100%;height:100vh;" > < / iframe >
console error
Refused to display" http://www.tjgp.gov.cn/portal." in a frame because it set"XFrametel Options" to "sameorigin".
this kind of solution?

Sep.27,2021

the reason is that the resources requested by the iframe window are not allowed to be placed in iframe due to the same origin policy of the browser (for security reasons). There are two methods:
1. If you can modify the configuration of the request server in the child window, you can set the iframe source domain name server response header x _ frame _ words to allow your own domain name to pass (for more information, please see MDN ).
2. If you can't change the configuration of the child window request server, write a proxy server (simply forward the request), request the domain name of iframe, and modify the response header xmurframeOptions.Then iframe accesses your proxy server.

Menu