1

I've got a page that has navigation inside of an iFrame. When I click on the navigation links inside the iFrame, the content only loads inside it. Is there a way for me to click on the links inside the iFrame and have the whole page go somewhere else? Not just the iFrame?

Thanks!

Kakenx
  • 1,315
  • 3
  • 18
  • 34

2 Answers2

4

Use the target attribute:

<a href="foo" target="_top">

Better yet, don't use frames for this. Use some form of template instead.

Community
  • 1
  • 1
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • Awesome! Thanks for the help! The iFrame was left from previous guy, and the owner doesn't want to change anything. So I'm stuck with it. – Kakenx Jun 25 '13 at 14:40
1

If the two pages are within the same domain you could try defining the following function into the outer frame:

function navigateToUrl(url){window.location = url;}

And then calling it from the inner frame like this:

if(typeof(parent.navigateToUrl)==typeof(Function)){parent.navigateToUrl('newPage.html')}
Giskard
  • 21
  • 4
  • Wow. That's … an overly complicated approach to the problem. – Quentin Jun 25 '13 at 14:00
  • So for example, the navigation is in the iFrame, but I have a link in the iFrame that goes to google. When clicked on that google link only the iFrame will navigate there. I need the whole page to go to google instead. – Kakenx Jun 25 '13 at 14:01