dcsimg
www.webdeveloper.com
Results 1 to 13 of 13

Thread: Forcing Visitors to Use Internet Explorer 5 or higher?

  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Question Forcing Visitors to Use Internet Explorer 5 or higher?

    Hi,

    I've designed a web site that for one reason or another only looks good in Internet Explorer 5 or higher

    Since most of my visitors are currently using IE5+, I am not too concerned about this except for the fact that I'd like to "force" all my visitors to use or upgrade their browsers to IE5+ before they can view the site.

    I've seen this feature used on other web sites whereby they block the viewing of certain web pages based on the browser (ie. Netscape 4.7, IE4, etc.) and was wondering how I would go about doing this for my own web site?

    Preferably, so that I don't have to update each page individually, I would like to use some kind of script that I can add to my directory that will run whenever a user visits any one of my web pages, detects the browser, and if it is not IE 5 or greater, shows a web page stating that IE5+ is required to view the information. Other suggestions are also appreciated.



    Any help would be greatly appreciated.




    P.S. -> I personally support browser alternatives like Netscape, Mozilla, Opera however the site was built in a rush and I didn't have a chance to follow the open standards and don't have the time to go back and fix it
    Thank you for understanding.

  2. #2
    Join Date
    Nov 2002
    Location
    London UK
    Posts
    154
    Try the script below. Place it as shown into a text file, and save the file with a .js extension (not .html).

    if (navigator.appName != "Microsoft Internet Explorer" && navigator.appVersion.substring(22,23) <= 4)
    {
    location.href = "whateverpage.html"
    }

    Now in the pages where you want to detect the users browser enter this line

    <script src="sitetest.js">

    Obviously you would change the file name sitetest.js to whatever name you saved the .js file as. Also you would need to change the whateverpage.html with the page you want all those other users who aren't using IE5+ to be redirected to.

    Note that this won't exclude some of the newer Opera browsers as they return "Microsoft Internet Explorer" for the appName property, and they return the same appVersion string as Internet Explorer. These two strings haven't changed since the early browsers so you shouldn't have to worry about new releases. If a change is made to these strings in future versions (doubtful though) then you only need alter the .js file to resolve any problems.

  3. #3
    Join Date
    Nov 2002
    Posts
    984

    Re: Forcing Visitors to Use Internet Explorer 5 or higher?

    Originally posted by powershot

    P.S. -> I personally support browser alternatives like Netscape, Mozilla, Opera however the site was built in a rush and I didn't have a chance to follow the open standards and don't have the time to go back and fix it
    Thank you for understanding.
    2 wrongs doesn't make a right.

    I would just put up a notice on the page that it sadly only works as it should in IE 5.5+.
    Prohibiting people from even accessing the site unless they use IE 5.5+ (which BTW shuts out ALL Mac and Linux users also) is the worst possible solution you could choose.

  4. #4
    Join Date
    Dec 2002
    Posts
    2

    Thumbs up

    Thanks for the coding advice MikeOS... I'll be sure to give it a try.

    As for "Two Wrongs Don't Make a Right," I guess that's the price I pay for quickly designing the page with "invisible" tables in M$ FrontPage.


    Thanks again.

  5. #5
    Join Date
    Nov 2002
    Location
    England
    Posts
    275
    You should bear in mind though that AOL and Compuserve (along with countless general users) are almost definately upgrading to Netscape 7, so that's a potential of over 37 million (if I remember correctly) users that you are locking out.

  6. #6
    Join Date
    Dec 2002
    Location
    Saint Louis , Missouri
    Posts
    157
    it might be better if you just put a script in html like onmouseover = alert"('Its recommended you use MISE4+'))" etc.

  7. #7
    Join Date
    Nov 2002
    Posts
    631
    Originally posted by Kaisa
    it might be better if you just put a script in html like onmouseover = alert"('Its recommended you use MISE4+'))" etc.
    Your alert code is wrong. That should be onmouseover="alert('text')". But that's ok.

  8. #8
    Join Date
    Dec 2002
    Location
    Saint Louis , Missouri
    Posts
    157

    Thanks

    I know the script was wrong i just want to use that like a example but anyway do you know how to use mouseover , onclick for images with links in HTML or java because i am trying to find how to script that in html or javascript using the easyest way possable

  9. #9
    Join Date
    Nov 2002
    Posts
    984

    Re: Thanks

    Originally posted by Kaisa
    because i am trying to find how to script that in html or javascript using the easyest way possable [/B]
    You forgot to say WHAT you wanted to happen...

  10. #10
    Join Date
    Dec 2002
    Location
    Saint Louis , Missouri
    Posts
    157

    Post Menu like script (:D

    Well i want make a menu with my own images where if you hold your mouse over them they will change to one of my other image then when you click on the them they change to a different image then the one you hold your mouse over and if you know how to add sound it also that will help even more !

  11. #11
    Join Date
    Nov 2002
    Posts
    984

    Re: Menu like script (:D

    Originally posted by Kaisa
    Well i want make a menu with my own images where if you hold your mouse over them they will change to one of my other image then when you click on the them they change to a different image then the one you hold your mouse over
    Do you want to return to the original image when you finally "mouse out"?

    If you do some simple CSS will do what you want.

    eg
    #img1to3 {display:block; width:100px; height:100px; background:url(image1.png) 50% 50% no-repeat;}
    #img1to3:hover {background-image:url(image2.png);}
    #img1to3:active {background-image:url(image3.png);}


    HTML:

    <a id="img1to3" href=""></a>

  12. #12
    Join Date
    Dec 2002
    Location
    Saint Louis , Missouri
    Posts
    157

    hmm

    if you don't mind a mouseout will be find to but i though it already did that when you move your mouse off it ?

  13. #13
    Join Date
    Nov 2002
    Posts
    631
    No, the onMouseOver attribute only activates a script when you move your mouse over it. After you have moved off, whatever happened when you did onMouseOver will still be there. To undo the changes, you use onMouseOut.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles