Angular 2 iframe refused to display

霸气de小男生 提交于 2021-01-28 05:50:28

问题


I have text input. My goal is when I enter url then hit enter. I want to open url in iframe. But some sites return an error. Is there a way to open a web page in iframe

Error message Refused to display 'https://www.mediamarkt.com.tr/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.


回答1:


You won't be able to display https://www.mediamarkt.com.tr/ in iframe as server forbids rendering the page outside of its domain name.

Response Header X-Frame-Options indicates from which source(s) page should be able to render. As it is set to sameorigin only applications from https://www.mediamarkt.com.tr/ domain are allowed to display it in iframe.

This is security measure in order to prevent clickjacking attack which prevents users into being tricked to click something they shouldn't have.

You can find more on X-Frame-Options header on the following URL: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

More on clickjacking can be found here: https://owasp.org/www-community/attacks/Clickjacking



来源:https://stackoverflow.com/questions/63576904/angular-2-iframe-refused-to-display

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