Iframe url cant be opened in html5? - html

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

Related

how to display a site in a iframe in html

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.

Can't embed contents using iframe

Here is the short simple HTML5 code that defines my page:
<!DOCTYPE html>
<html>
<head>
<title>My Site</title>
</head>
<body>
<iframe src="2.html" width="450" height="350"> </iframe>
</body>
</html>
I have triple-checked that file 2.html exists in the same directory, and it has some code in it. I have cleared caches and history in my browser, but observed no page embedded. I have tried this in Chrome, Firefox and IE too, but am getting nothing. I just got the iframe box with border, that's completely white (blank). What's wrong with it?

Link inside iframe wont work

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

Embedded pdf display affected by <!DOCTYPE html>?

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>

How does Facebook prevent you from putting the site into an iFrame?

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