How to make links inside an IFRAME to open outside this Iframe? - iframe

I have created a widget kind of. In reality I put the information in a php file and then I provided the Iframe code for this file to my members.
Considering site A is member's site and site B is my site.
Site A shows the IFRAME:
<iframe src="http://siteB.com/try.php" height="240px" width="286px"></iframe>
When this IFRAME is clicked, it opens a new pop window, because of this code:
<?php echo $status_img; ?>
So far so good.
Now the problem is this pop up window also has a link. How can I make this link open outside this IFRAME, to be more specific, to take them to Site B , my site . At the moment this link opens inside the iframe and it can't be used this way.
This last link is:
<a onclick="return targetopener(this,true)" target="_top" href="http://siteB.com/services.php">
It works perfectly in my site but not in an Iframe. I know I complicated myself a little with this iframe but I adapted a solution to my poor knowledge. I'm opened to new solutions though, if this link can't be opened outside the Iframe. Thank you in advance!

Try changing target to _parent if you want the link to open in the previous window (it's parent window). So if site B opens up a pop-up with site A inside that then must refer them back to Site B then this should open the link in the window that spawned the popup.
But if you want it to open a new window that leads to your website then of course use _blank.

You can use this base tag. Place the tag in the iframe. Should solve your issue.

Related

web pages stop rendering after iFrame loads

We have a web page in our solution that uses an iFrame to display a vendor's web page. Usually when a user navigates away from this page that hosts the iFrame, all the other pages render just fine. The vendor just redesigned the content of their page, however, and while their new page looks fine in the iFrame and that hosting page works fine too, any time a user navigates away from the hosting page, the page being redirected ~to~ does not render properly. It's just completely blank. An f5 will get it back, but I'm wondering what I can do to fix this. The vendor says it's not their problem, but that's the only thing that changed. I've tried both redirecting the iFrame to blank and removing it outright via javascript (see below), and while I can see the iFrame disappear just before the redirect, the redirected to page still will not render without hitting f5.
window.onbeforeunload = function ()
{
document.getElementById('<%= ifr.ClientID %>').src = "about:blank"
$("#<%= ifr.ClientID %>").remove();
}
Can anyone give a suggestion of why this is happening and how to prevent it?
TIA
-VG
I've had a similar problem when using an iFrame containing a page from our payment card processor embedded in our eCommerce pages. I couldn't see anything in the source of the iFrame that might be causing the problem, so I opened up space for the iFrame, contained it in a div (my last element on the page) and used position to render the iFrame in the position I wanted it. Hardly responsive design, but it worked!
For anyone coming to this from the first Google result, this can be caused by your iframe being self-closed (ending with />). To fix it you just need to close the iframe with </iframe> instead. This may not be the original problem but it worked for me.

issue opening thickbox from inside an existing iframe

So I seem to have found myself in a bit of pickle. In order to keep a header flash element from reloading every time someone goes to a different page, I encapsulated all my site's content in an iframe. Unfortunately, some of the iframe's include thickbox, which opens an iframe of it's own. The iframe that thickbox opens, requires it be opened on the topmost page, so that the fixed attribute allows the iframe to remain static in the viewport. Because we're already nested into an iframe, this isn't possible.
This is the most promising lead I have so far:
http://blog.codepyro.com/2010/01/thickbox-inside-of-thickbox-iframe.html
Unfortunately, that only replaces the iframe that the thickbox is being opened from, with the content of the thickbox.
I also just came across this, but I'm not sure how I would go about retooling it to suit my needs:
open iframe fancybox from within an iframe so that it opens in the parent
Here is a link to what I'm working on:
http://www.lalalandmusicfestival.com/site/
The problem area is on the Talent page.
I think if there was a way to force the link to target the "top" or "parent" page with javascript, it may be possible, but I haven't found anything that's been of any use to me yet.
Thanks in advance for your help!

adsense loads in the wrong iframe

I´m having a big big problem with adsense, no matter what I do the adsense result iframe is loading inside other iframe. I´m using WordPress + Bootstrap Framework.
This particular site has two different ads, first use an adserver service which give me his own script, this script is placed in the header.php inside of a <div id="top-space"> and the adserver handle with the script to show an <iframe> and inside that iframe the objet flash of the banner.
The adsense code is in the sidebar and to place it I use a text wodget, put the code there and that´s it.
In 60% of the times the site loads in the correct position each banners, the adserver banners are in the top and adsense ads in the sidebar.
BUT! randomly the adsense iframe is loading inside of the adserver iframe. I tried to use this solution but don´t work at all.
I´m desesperate because my client is loosing money, the site don´t show the right ads, and some times adsense iframe push adserver ads so the site looks crappy.
Even I try to use adrotate wordpress plugin thinking that help me avoid this bug, but nothing.
This sounds like it could be a caching problem. I've noticed in the past, iframes usually don't refresh unless you specifically right-click and refresh each individual one. If you're running any WordPress caching, clear that, then your browser cache, or try an incognito window.

Protect Iframe From Openining In New Window Or Tab

I am adding framed content to a wordpress blog in a membership area. Is there a way that I can prevent that content from being opened in a new window or tab? A plugin or a string of code I can add?
As it is now if someone right clicks on the frames content they can view it in a new window and possibly share that URL rendering the membership site useless in controlling who views....
I would like a block.... If possible...I see other iframes popup an error message when you try and view....
Any help is appreciated!
Thank you for a great place for info
One possible solution I can think of is now to add JavaScript code to prevent right click, but again this is not always going to work because the person can simply disable JavaScript and they can still right click to see the content of the iframe. Not only that there is alway a way to sniff the URL of the iframe by either using some sort of software or even using something like FireBug.

Parent content with iframe in blank page?

I have created a web page which for example contains some links and an iframe. These links are opened in iframe, so everything outside iframe is static (parent content doesn't reload). All works fine and all my pages are well structured so that it's easy to understand code of page.
But when I press a middle button on one of the mentioned links (to open it in a new tab or window) that isn't in iframe and normally should open in iframe, a browser will only display the content which is inside iframe and parent content will be lost.
What could be the best solution for this problem?
The only thing I need is an iframe which works as usual, targeted links are opened in it.
If a link is opened in a new tab or window, it looks the same if the link would have opened with a left click of mouse.
Instead of links you can use buttons, on them right or middle click can't be performed.
Better solution. Now I'm using jQuery BBQ with modified and improved initialization code.

Resources