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 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Browser blocking

    Do somebody know how to "block" or prevent a user from accessing a page from other navigators than IE; in a way that they have an alert telling to install IE or something, not redirecting to an alert page?

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    you could do that any number of ways. i think you need to ask yourself if you really want to, though. there are a lot of people ( like myself ) who don't use IE, and you could end up losing a substantial number of visitors that way. and what about people who use screen readers and such?

    you'd be better of just designing your site to work only in IE. that way, people using other browsers could still get to the site, they just wouldn't have the benefit of all your cool stuff.

    personally, i recommend cross browser coding, to reach the largest audience.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Yes you can but its not a very good practice unless there is something very specific you are doing, like mentioned above.

    Nevertheless, look at this script: http://www.javascriptkit.com/script/cut5.shtml

    You should be able to use it with a minimal editing. Like:

    Code:
    <script type="text/javascript">
    <!--
    /*By George Chiang (JK's JavaScript tutorial) 
    http://www.javascriptkit.com
    Credit must stay intact for use*/
    var n=navigator.appName
    var ie=(n=="Microsoft Internet Explorer")
    if (ie)
    location="page.htm"
    else
    location="wrongbrowser.htm"
    //-->
    </script>
    Try that out.
    Last edited by oracleguy; 03-30-2003 at 12:41 AM.
    OracleGuy

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Iowa / Notre Dame
    Posts
    538
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you absolutley can't code cross browser, just do what Joh6nn said and code for IE. If it would make you feel more comfortable you could always do a little javascript detect and, if someone is using a browser that isn't IE, print a little message at the top that says "This page works best in IE!"

    Please don't block the page unless it is absolutley necessary
    My Site {Mike's Adventures}

    Yikes, forums are almost too much fun.

  • #5
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have fun detecting for opera
    http://javascriptkit.com/javatutors/navigator.shtml
    may help ...

    this seems like a JS question?

  • #6
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Originally posted by cg9com

    this seems like a JS question?
    Yeah but you also could do it server-side too.
    OracleGuy

  • #7
    Senior Coder
    Join Date
    Jul 2002
    Posts
    1,628
    Thanks
    0
    Thanked 0 Times in 0 Posts
    JS thread then.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Beyond Lament
    Posts
    424
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by cg9com
    have fun detecting for opera
    The trick is to detect Opera first, before looking for IE.

    My example:

    <script language="JavaScript">
    <!--//
    if (is_opera && is_win)
    document.location.replace('xBrowser.html');

    else if (is_ie5up && is_win)
    document.location.replace('index.htm');

    else
    document.location.replace('xSystem.html');
    //-->
    </script>
    Quíet Storm Designs ~ Art is not what you see, but what you make others see.
    · the Storms· || ·Ultraviolent Winter· || ·Was Einstein Wrong?· || ·It´s About Time!·

  • #9
    New to the CF scene
    Join Date
    Mar 2003
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up Finally got done

    Thanks to everybody, in fact I wanted this stuff for an Intranet browser based program, not for web use.

    Anyway you were very helpful and my work is done.
    Thanks a lot

  • #10
    Regular Coder
    Join Date
    Jan 2003
    Posts
    680
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What if people on that Intranet turn JavaScript off then?
    (o<
    //\ &nbsp; &nbsp; &nbsp; =^..^=
    &nbsp; &nbsp; $!

  • #11
    Regular Coder
    Join Date
    Jun 2002
    Location
    Beyond Lament
    Posts
    424
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Originally posted by meow
    What if people on that Intranet turn JavaScript off then?
    Too bad for them - they'll be missing out.

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can use IE conditional comments - http://www.javascriptkit.com/howto/cc2.shtml

    But obviously I don't approve ... [mumble]
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

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