SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Goof's Avatar
    Join Date
    Feb 2001
    Location
    Pittsburgh, PA
    Posts
    1,154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Redirect?

    I'm trying to write a redirect, so that after x seconds the page automatically forwards the user to another page. I'm guessing I need to do it in javascript (throw it in a function and call it onLoad) because I need to not only redirect, but clear a frameset (that can't be done with META redirects, correct?). Could anyone point me in the right direction?

    Much appreciated,
    Goof
    Nathan Rutman
    A slightly offbeat creative.

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use setTimeout to redirect after so many milliseconds.
    <SCRIPT LANGUAGE="JavaScript">
    setTimout("location.href='somepage.html'",3000)
    </SCRIPT>

    The above should redirect after 3000 milliseconds (3 seconds).

    Or you could put it in a function and then perform the function.
    <SCRIPT LANGUAGE="JavaScript">
    function Goto()
    {location.href="somepage.html"}
    setTimout("Goto()",3000)
    </SCRIPT>

    If you place the above in the head section of your document the setTimeout should work when the page loads.

  3. #3
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If by clear frameset you mean redirect the whole page, from the parent - then yes - it's fine to do it with a meta in the parent.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  4. #4
    SitePoint Wizard Goof's Avatar
    Join Date
    Feb 2001
    Location
    Pittsburgh, PA
    Posts
    1,154
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Flawless,

    No, I need to redirect out of a frameset from within one of the frames. I think setting the document.parent.location property will do it in javascript, correct?

    Thanks guys,
    Goof
    Nathan Rutman
    A slightly offbeat creative.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •