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
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.
I have some HTML code I'm trying to embed into a site.
The code is an iframe that is supposed to have a bunch of links in it, but when I click the links, they just load the page inside the iframe block.
Here is the code:
base.html
<head height="200" width="300">
Text
</head>
<div>
<body>
<iframe height="200" width="300" src="test.html"></iframe>
</body>
</div>
test.html
<head>
Link
</head>
Is there a way for me to tell the link NOT to load inside the frame?
I already know of a workaround which is to add "target="_blank"" to the link so it opens in a new tab.
Try adding the target attribute as shown below
Link
the tag _parent will target the iframe's immediate parent window.
the tag _top will target the top window.
Try adding target="_top" this should target the parent URL instead of the iframe URL
<head>
<a target="_top" href="file:///Users/Jean/base.html">Link</a>
</head>
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?
I have two page index.html and my.html
the my.html will appear as iframe in index.html
and in my.html will a link, if any one click the link http://www.swisteronline.in need to open. I do it, but the page http://www.swisteronline.in is opening in iframe in place of my.hml. but i need to open the site in place of index.html what to do?
index.html
<html>
<head>
<title>Index</title>
</head>
<body>
<iframe src="my.html" height="100%" width="100%" scrolling="no" frameborder="0">`</iframe>`
</body>
</html>
my.html
<html>
<body>
Click here to go
</body>
I need to open http://www.swisteronline.in when anyone clicke on "Click here to go" in place of index.html. I can only open it in place of my.html
what to do? please help... thanks
Add target="_parent" in anchor tag inside my.html
Click here to go
When I click the link home on the page, the corresponding file opens up in the iframe shown by the arrow as it is targeted at it.
But, when I right click the link and click on open link in new tab then only the page corresponding to the link i.e the content of the iframe, opens up in the new tab and not whole layout.
What I want is that when I open that link in a new tab, the exactly same thing opens up in the new tab as shown in figure.
So basicly your problem is: you need to check if the iframe content is actually being open inside an iframe.
With window.top you can achieve that.
After that, if you content is not being open inside an iframe, make it redirect to the main page.
This is a sample, but i guess you can adapt for what you want:
home.html
<html>
<head>
<title>Main Page</title>
<head>
<body>
<h1>Main Page</h1>
Page 2
<iframe name="myIframe" src="page1.html"></iframe>
</body>
</html>
and page2.html
<html>
<head>
<title>Page 2</title>
<script>
if (window.top == window.self) {
window.location.replace("mainpage.html");
}
</script>
<head>
<body>
<h1>Page 2</h1>
</body>
</html>