Rickstar
Rickstar

Reputation: 6199

iframe changing main page jquery or html

i have a iframe and it is linked to pictures.html and on this page i have links but when i click the links it changes the ifame page is there anyway i can change the main page using jquery or something?

Upvotes: 0

Views: 457

Answers (4)

tcooc
tcooc

Reputation: 21269

You can use target="_top" to change the top page's location:

<a href="page.html" target="_top">change main page location</a>

or _parent to change parent page's location

<a href="page.html" target="_parent">change parent page location</a>

Upvotes: 3

T.T.T.
T.T.T.

Reputation: 34623

you can have the link open in a new window or tab....

The HTML to open a new window:
      <a href=”http://sitename.com”  target="_blank">Link text here</a>

Upvotes: 0

Joey C.
Joey C.

Reputation: 2386

you could have the links on pictures.html have onclick events that send the location to the parent window.

 $(".link").click(function() {
    window.parent.location = $(this).attr('href');
    return false;
 });

Upvotes: 0

GSto
GSto

Reputation: 42380

you don't need jQuery, you can do this regular javascript.

in your iFrame:

<a href="#" onclick='window.parent.location="www.newurl.com"' />

Upvotes: 0

Related Questions