Mozilla Browser Check

Discussion in 'Software' started by Yzaraf, Jun 4, 2005.

  1. Yzaraf

    Yzaraf Private E-2

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
        <title>Browser Check</title>
    <script language="JavaScript">
    function isMozilla() {
    	return (navigator.appName == "[B]Mozilla Firefox[/B]")
    }
    </script>
    </head>
    
    <body>
    <p>This is a portal to the main page...</p>
    <p><a href="index.htm">Click here to go to the main page.</a>
    <script language="JavaScript">
    if (isMozilla() == false)
    document.write("<p>Agh! You're using not using <a href='http://www.mozilla.com/'>Mozilla Firefox</a>! This site might not render correctly!</p>")
    </script>
    </body>
    </html>
    
    What should I put as the Navigator Application name (in bold) for it to recognize if firefox is being used or not? I've tried mozilla firefox... and that doesnt seem to work!
     
  2. goldfish

    goldfish Lt. Sushi.DC

    That would be because the appName that firefox shows up as is Navigator, not mozilla.

    You need to use the User Agent string to get a real idea of what browser they're using (navigor.userAgent).
     
  3. Kodo

    Kodo SNATCHSQUATCH

    that should be a server side call anyway. If javascript is turned off or some dt app is blocking js , then what are you going to do.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds