Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Macintosh Browser redirect for IE 5 not working

    Hello forum! This script is supposed to redirect IE 5 to a page on my site.
    However, the code is not doing the redirect part.
    Take a look:

    Code:
    /*******************************************************************************
    	OLDIE - or Old IE. A script that finds the version of IE you're using,
    	and redirects if lower than the set parameter.
    	[[ Created by Ryan McLaughlin, www.DaoByDesign.com ]]
    *******************************************************************************/
    var browser		= navigator.appName
    var ver			= navigator.appVersion
    var thestart	= parseFloat(ver.indexOf("MSIE"))+1 //This finds the start of the MS version string.
    var brow_ver	= parseFloat(ver.substring(thestart+4,thestart+7)) 
    
    if ((browser=="Microsoft Internet Explorer") && (brow_ver < 5)) //Change to suite
    	{
    	window.location="../oldie.html"; //URL to redirect to.
    	}
    I also would like to point out that the code belongs in a .js file.
    NOT <script type="javascript".........
    Last edited by FrickenTrevor; 02-12-2010 at 03:54 AM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    MSIE 5 might insist on seeing location.href instead of just location.

    Did you test it with an alert() to see if it's getting to that line???
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Erm no, and I dont really know how to do that alert thing
    Oh and that wasnt me who made the script

  • #4
    New Coder
    Join Date
    May 2009
    Posts
    47
    Thanks
    3
    Thanked 0 Times in 0 Posts
    if ((browser=="Microsoft Internet Explorer") && (brow_ver < 5)) //Change to suite
    {
    alert("FrickenTrevor got this far in my script");
    window.location="../oldie.html"; //URL to redirect to.
    }

  • #5
    New Coder
    Join Date
    Aug 2009
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Internet Explorer

    Sorry mapleleaf, but theres no alert that came up
    I used IE 5.5 to test it.
    Still lost btw

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,479
    Thanks
    6
    Thanked 981 Times in 954 Posts
    Then this query:
    Quote Originally Posted by mapleleaf View Post
    if ((browser=="Microsoft Internet Explorer") && (brow_ver < 5)) //Change to suite
    most likely doesn’t return “true”, i. e. the browser doesn’t identify itself in the way the script is looking for it.

    Hm, it just occurs to me… You seem to be looking for IE lower than version 5 (brow_ver < 5). What happens if you change that to brow_ver < 6?

  • #7
    New Coder
    Join Date
    Aug 2009
    Posts
    40
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Exclamation

    It worls!!!
    Thanks VIPStephan!

    I took this
    Code:
    if ((browser=="Microsoft Internet Explorer") && (brow_ver < 5))
    and changed the 5 to a 6 and now it works, alert and everything!

    thans for every one who helped


    Resolved


  •  

    Posting Permissions

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