Click here to Skip to main content
14,545,210 members
Rate this:
Please Sign up or sign in to 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
Rate this:
Please Sign up or sign in to vote.

Solution 1

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
   
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 4 days ago
   
Thanks
Varun Sareen 24-May-20 23:41pm
   
Absolutely
Rate this:
Please Sign up or sign in to vote.

Solution 2

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.
   
Comments
vulisiramu 4 days ago
   
Thanks

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

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100