SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Redirect help!

  1. #1
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Redirect help!

    Hi,


    I'm a forum newbie requiring a bit of java expertise from someone..

    Basically my problem is that I am hosting multiple domains on one hosting account so in order to direct traffic to the homepage that corresonds to the entered domain name I am using a java redirect script on the index.htm file which works fine.

    The problem however is that when you click the back button on the web browser you simply execute the redirect script again which immediately redirects you back to the homepage. Obviously as a user this can be pretty annoying.

    Below is the coding I am using in the redirect script;

    <script language="javascript">

    var whois=location+" "

    if (whois.indexOf("pixelpaks.com") != -1)

    { window.location ="index1.htm" }

    if (whois.indexOf("www.pixelpaks.com") != -1)

    { window.location ="index1.htm" }
    </script>


    As you can see the script is very simple but I am hoping that someone on here can advise me on getting round this problem of not being able to click back on the browser to the previously visited webpage.

    Thanks in advance.

    Dan.

  2. #2
    SitePoint Member
    Join Date
    Dec 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bumped..

    Please if anyone could advise I would really appreciate it.

  3. #3
    SitePoint Addict NikoB's Avatar
    Join Date
    Nov 2005
    Location
    Austria
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use window.location.replace("url") instead. This allows a url to be skipped by history, so the backbutton works.
    Corinis OpenSource Community & Content Management
    http://www.corinis.org


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
  •