0

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 but it does not work either. Please help

3
  • Please do not attempt to learn from w3schools.com Commented Apr 10, 2018 at 20:56
  • @AluanHaddad why? Commented May 31, 2018 at 16:57
  • @Steve because it provides incorrect information and promotes exceptionally bad practices to this day. Commented Jun 16, 2018 at 13:16

1 Answer 1

3

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/>.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.