Results 1 to 7 of 7

Thread: Drowser Based Message

  1. #1
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Drowser Based Message

    Hi!
    I was wondering if any of you guys could help me find a script that would show a message based on browser, For example say that i built a script for ie only and someone with netscape tried to use it it would display a warning.

    Anyone know?

    Thanks

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I like the title idea better. I think that is what we need sometimes. As things stand these days, this is a fairly good test of IE/Not IE:

    Code:
    if(!document.documentElement.filters){
    alert ("Get IE, the most widely used browser because, I don't know how to code for other browsers.")
    }
    else {
    alert("Ah, I see you've IE!")
    }
    Tongue firmly in cheek I think you can see that I don't think this is the very best of ideas. A better approach is (if there is any doubt that it is universally supported) to test for each method that you are using, providing an alternative method that is either supported by all or most other browsers. Sometimes there just isn't (or you can't figure one out) a good alternative. In a case like that, most of the time you can just skip the 'special effect' for other browsers and the script can still perform its basic function or (depending upon what that function is) the page can stand alone in other browsers without the script. Either way, there is no need to make any announcement about it.

    This last idea is really key. Your page should be accessible to all browsers even if they have javascript turned off. That way, any twists and turns you take in a script won't matter, as long as no logical or coding errors are made.

    If you were to give me the specifics of the script and the HTML it is meant to work with, I can probably come up with a way to make the script work cross browser, or at least degrade gracefully under those browsers that do not support it.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    jscheuer1 is right, you really shouldn't be forcing your users to be using one browser or the other in order for your site to look right. If certain JavaScripts on your page do not work in a certain browser, as long as it's done gracefully (no JS error pops up), that's a good enough compromise. If you like to learn how to modify scripts yourself to degrade nicely in non compatible browsers, this is a good object detection tutorial.

    As for detecting non IE users, there are a million ways, some more reliable than others, I think something like this should do nicely:

    Code:
     <script type="text/javascript"> 
     
    if (!document.all && !window.opera)
    alert("You are NOT using IE4+!")
     
    </script>

  4. #4
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    THANKS!

    Im going to try thoses BRB. . .

  5. #5
    Join Date
    Nov 2005
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    ALRIGHT!!! IT WORKED. I PUT IT ON MY SITE. CHECK IT OUT AT HTTP://WWW.THEEASYMAIL.COM

    THANKS GUYS!

  6. #6
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Connection has timed out

    The server at www.theeasymail.com is taking too long to respond.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  7. #7
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Oh, it's loading now. Very slow server.

    A message box really isn't the best way to do that. You should consider just making your site cross-browser compatible

    -cr3

    P.S - Having too many keywords will cause Google to see your site as irrelavent, and will lower your search ranking.
    P.P.S - Ack, you paid for that web design from Websites4u? ACK!
    Last edited by cr3ative; 12-05-2005 at 11:01 AM.
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

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
  •