The following code doesn't work. How does Facebook do this? Is there any way around it?
<html>
<head></head>
<body>
<iframe src="http://www.facebook.com" width="500" height="500">
</iframe>
</body>
</html>
This is because they have <meta http-equiv="X-Frame-Options" content="deny" /> in their source.
They do this to avoid scams and click jacking. This is impossible to do. It's a security feature that wont be going anywhere...
Related
<!DOCTYPE html>
<html>
<head>
<title>Iframe</title>
</head>
<body>
<iframe src="https://www.youtube.com/watch?v=dQBzT3XBwzU" width="600" height="600">
<p>Youtube</p>
</iframe>
</body>
</html>
This code show me empty frame and i dont know why. I tried some other urls and some of them works and some dont
You are probably getting a does not permit cross-origin framing issue. Check your console.
Why does this code not display the YouTube site or other sites like Pandora:
<html>
<body>
<iframe src="https://www.youtube.com"></iframe>
</body>
</html>
The reason is, that youtube doesn´t allow that way of access. Just with an embed code, like:
<html>
<body><iframe width="640" height="360" src="http://www.youtube.com/embed/M7lc1UVf-VE" frameborder="0"/>
</body>
</html>
This will work, but whole youtube can´t be embedded.
Have a nice day.
The web page is not displayed when the following was inserted in the html. Neither was this working for any other link. Please tell me what is the problem in this?
<!DOCTYPE html>
<html>
<body>
<h2>HTML Iframes</h2>
<p>You can also use the CSS height and width properties to specify the size of the iframe:</p>
<iframe src="https://www.w3schools.com" style="height:500px;width:900px"></iframe>
</body>
</html>
Per the console:
Refused to display 'https://www.w3schools.com/' in a frame because it
set 'X-Frame-Options' to 'sameorigin'.
This means that W3 Schools will not allow you to display its pages in an external iframe.
No need to have the style attribute.
<iframe height="500px" width="800px" src="https://www.google.com" ></iframe>
That should fix it.
This drives me totally crazy now. A link (http://ns.nl) on the page inside the iframe I made wont work (http://newsoundsofeurope.com/videos/playlisttest). Chrome doesn't do anything after the mouse click. Firefox just opens a blank page inside the iframe. Anyone can help?
Page with iframe:
<html>
<head>
</head>
<body>
<iframe src="playlist_iframe.php"></iframe>
</body>
</html>
Page inside iframe:
<html>
<head>
</head>
<body>
<img src="026.png"/>
</body>
</html>
Remove target="_self and will work.
If you want to open that link with a new page, you need to set the target="_blank"
<img src="026.png"/>
Also need to set the 'allow-popups' permission in the iframe
<iframe src="playlist_iframe.php" sandbox="allow-popups"></iframe>
https://www.w3schools.com/tags/att_iframe_sandbox.asp
I'm trying to embed a pdf into webpage and found a strange phenomenon. When I use this html:
<html>
<head>
</head>
<body marginwidth="0" marginheight="0" style="background-color: rgb(38,38,38)">
<embed width="100%" height="100%" src="some.pdf" type="application/pdf">
</body>
</html>
Everything worked as expected. However, when I insert <!DOCTYPE html> into the first line, my browser only display part of the pdf.
Will anyone explain this strang behavior to me? It took me hours to figure out that it's the doctype line that's causing the problem so I'm really curious why.
Doc types tell validators which version of HTML to use in checking the document's syntax. Here's a list of DOCTYPES that helps explain what each of them do.
You can probably also have the PDF file align & scale itself automatically by wrapping the embed tags with "p align" like this:
<html>
<head>
</head>
<body marginwidth="0" marginheight="0" style="background-color: rgb(38,38,38)">
<p align="center"><embed width="100%" height="100%" src="some.pdf" type="application/pdf"></p>
</body>
</html>