Click here to Skip to main content
15,883,809 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have created small html page, I want to call below URl into the html page but it is not rendering, can some one please help on this

<!DOCTYPE html>
<html>
<body>
<iframe id="idMyIframe" src="http://www.yahoo.com"> </iframe>

</body>
</html>

What I have tried:

<!DOCTYPE html>
<html>
<body>
<iframe id="idMyIframe" src="http://www.yahoo.com"> </iframe>

</body>
</html>
Posted
Updated 21-May-20 7:24am
v5

Dear Friend,

The reason why external websites such as:
1. youtube.com
2. google.com
3. stackoverflow.com etc.

are not loading in your frame, is because they are intentionally leveraging some sort of Frame Killer. 


For your reference and suggested reading:
Framekiller - Wikipedia[^]
Busting a tough FRAME killer
[^]

html - iframe and external website - Stack Overflow[^]

I hope this resolves your problem. Accept this as your solution if it helps.

Regards
Varun
 
Share this answer
 
Comments
Richard Deeming 21-May-20 13:20pm    
That may have been true 10 years ago. Today, it's much more likely that they're using a CSP or the X-Frame-Options header to prevent their content from being loaded inside other sites.
vulisiramu 27-May-20 10:18am    
Thanks
Varun Sareen 24-May-20 23:41pm    
Absolutely
The site you're trying to load has either set the X-Frame-Options[^] header, or has sent a content security policy (CSP) with the frame-ancestors[^] directive, both of which will instruct all modern browsers to prohibit loading the site in an <iframe>.

In the case of Yahoo, it's sending:
X-Frame-Options: SAMEORIGIN
which means only pages hosted on the yahoo.com domain can load other yahoo.com pages in an <iframe>.

This is generally done for security reasons. There is no way for an HTML page to bypass this.
 
Share this answer
 
Comments
vulisiramu 27-May-20 10:17am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900