
-----------------------------------
Warchamp7
Mon Sep 21, 2009 3:58 pm

Refresh iFrame Parent
-----------------------------------
I'm trying to think how to best explain this

I have a webpage with an iframe on it which is a third party site. Now, through the navigation links on this site, it is possible to navigate back to the main page containing the iframe.

Is there some sort of code I can place on the main page so that it will refresh once when visited, thus preventing you from loading the page within itself?


Also if this is better suited for Web Design, my bad.

-----------------------------------
DtY
Mon Sep 21, 2009 4:53 pm

RE:Refresh iFrame Parent
-----------------------------------
I'm confused, this is what I understood,

You have a page with content within an iframe, in that iframe there's a link to the current parent page, so that when you click on it, the main window is a page that contains an iframe, and within that iframe is the current page, which contains an iframe?

I believe that you can use javascript to check the url of a frame (frameref.location like window.location from inside), if the frame location is on the same domain.

-----------------------------------
Zren
Mon Sep 21, 2009 10:31 pm

Re: Refresh iFrame Parent
-----------------------------------
I think you should look at it like those sites that automatically get rid of any frames when someone uses frames on them (you've probably seen flash games sites do this). They use something like this in Javascript:






or

if(parent.location.href!=location.href) top.location.href=location.href;

SRC: http://www.webdeveloper.com/forum/archive/index.php/t-50973.html

The thing is, your locations might be the same (I'm not sure if there will be some sort of OoP on the location), so you might want to check and see if you're "location" is at the top level, in fact, this script might even work by itself. You'll just have to grab out the more important parts for your purpose.






SRC: http://bignosebird.com/js/h43.shtml

-----------------------------------
Warchamp7
Tue Sep 22, 2009 12:17 pm

Re: Refresh iFrame Parent
-----------------------------------







This seems to be working perfect. Thanks a bunch!
