SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    javascript to load a new page

    Hi everyone - I don't know much about js but what I am trying to find is a simple script that will automatically load another page when the first page is called. I want this to send people with browsers with js enabled off to another page but keep people with js disabled on the original page (ie do nothing if no js).

    If anyone could be of help that would be great.

    Jonathan

  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work...

    <script language=javascript1.2>
    <!--
    newWin=window.open("url of js page","title of url page");
    //-->
    </script>

    Just by having that in there it will automatically send the person with JS enabled to the other screen. It will also leave anyone with javascript1.2 or less or no javascript at the default page.

    Hope that helps
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey - thanks Maelstrom - that works.

    Is there any way for me to edit this script so it does not come up in a new window but just replaces the same page?

    Thanks


    Jonathan

  4. #4
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by forrest
    Hey - thanks Maelstrom - that works.

    Is there any way for me to edit this script so it does not come up in a new window but just replaces the same page?

    Thanks


    Jonathan
    To replace the current page simply

    top.location.href="url to javascript windoow";
    instead of opening a new one.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2001
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Maelstrom - very cool - it works.

    Jonathan

  6. #6
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My pleasure
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


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
  •