I got this in my angular2 v4 app:
<iframe src="https://www.w3schools.com" style="width: 100%; height: 500px"></iframe>
but it doesn't work. How can I make this work? I tried using | safe
| safe
but it does not work either. Please help
If you were to look in your console, you'd probably see this message:
Refused to display 'https://www.w3schools.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
The X-Frame-Options
header allows websites to prevent sites with differing origins (domains) from using them within an <iframe/>
. This basically means that only pages hosted on www.w3schools.com
can use that url in an <iframe/>
source. You can read more about it here .
You code (which you neglected so share much of) is most likely okay syntactically. You can try another url for your <iframe/>
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.