angular js load external site in iframe

杀马特。学长 韩版系。学妹 提交于 2019-12-12 06:10:08

问题


I have one angular js application which is running on nodejs. I want to load an external site, the external site is also my application which is running on different IP, with-in a div while loading the template url. So in template url I mentioned one HTML file. Inside that HTML file I had written like this.

<iframe src="myexternalurl"></iframe>

But in error console it is coming like:

Refused to display 'myexternalurl' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

回答1:


Change the x-frame-options header to ALLOW-FROM {your app domain}

Apparently on your other application's host/server/app the header x-frame-options set to SAMEORIGIN you need to disable that header or correct it according to the x-frame-options possible values: https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options




回答2:


You can simply add following line to .htaccess in your external site (If its your application)

Header always unset X-Frame-Options

If you want to allow some specific site. refer the below link

https://developer.mozilla.org/en-US/docs/Web/HTTP/X-Frame-Options



来源:https://stackoverflow.com/questions/29046482/angular-js-load-external-site-in-iframe

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!