How to open new page in frame without being framed by old page frame

20 pts.
Tags:
JavaScript
Web development
Our site uses a frame for navigation (not my design), and one of site owners wants to redirect users to a new page on the site if they bookmarked the old page URL, giving them a message page first that says the old page has gone away and to bookmark the new one. Message page then closes after 5 seconds and new page opens. When I try this using self.setTimeout, the new page opens with navigation frame inside the navigation frame for the old page, which will not do. How do I make the old page navigation frame close and open the new page with its own navigation frame? Here is the code I'm using: <head> <script language="javascript"> <!-- Set timeOut to the time to wait before redirecting --> <!-- Set newSite to the page you want to be redirected to --> <!-- timeOut = "2000"; newSite = "http://weblibrary.vh.eng.vzwcorp.com/weblibrary/home.do?dept=NSS"; function timer() { self.setTimeout("self.location.href = newSite;",timeOut) } //--> </script> </head> <body onload="timer()"> Thanks!
ASKED: April 23, 2008  2:31 PM
UPDATED: April 24, 2008  1:15 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

Do you have to open a new window and then close the old one? Or would it be enough to simply open the new frame in the top-level window of the old one? The result would be the same (new window is open, not within a frame, and the old window is closed) and you wouldn’t run into any problems with popup blockers.

If that solution will work, try this:

<pre>function timer() {
self.setTimeout(“self<b>.top</b>.location.href = newSite;”,timeOut)
}</pre>

A window’s .top property refers to the top-level window — the one that contains the frame.

HTH!

<b>That work’s great! Thanks for the help!</b>

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • YuvalShavit
    No problem! Nice screen name, btw -- though I've always liked Catullus 8 most, personally. :-)
    905 pointsBadges:
    report
  • Catullus13
    [...] Blog Archive Popular Uses of YouTube in ...How The Kernel Manages Your Memory : Gustavo DuarteHow to open new page in frame without being framed by old page frame [...]
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following