/    Sign up×
Community /Pin to ProfileBookmark

redirect one iframe from inside another

i have a page with two iframes “MAIN” and “MENU”.

when the page inside the “MAIN” frame is loaded i want to make the “MENU” frame go somewhere else.

in the body onload event of the page inside the “MAIN” frame i have the following:

[CODE]parent.document.getElementsByTagName(‘iframe’)[‘MENU’].location.href=’somewhereelse.html’;[/CODE]

i think i’m referencing the frame correctly, because i can resize it as follows:

[CODE]parent.document.getElementsByTagName(‘iframe’)[‘MENU’].width=20;[/CODE]

i just can’t get it to redirect.

what’s up?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@akoszauthorNov 11.2004 — wait, this seems to work:

[CODE]
parent.MENU.location.href='http://www.yahoo.com';
[/CODE]


i swear to god, javascript makes no damn sense. because this doesn't work for width! it's like the total opposite!

[CODE]
parent.MENU.width=20;
[/CODE]
×

Success!

Help @akosz spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ,
analytics: Fullres
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Marika,
tipped: article
amount: 1000 SATS,

tipper: @hatem774,
tipped: article
amount: 1 SATS,

tipper: @nearjob,
tipped: article
amount: 1000 SATS,
)...