Super Web Mart - Discount Coupons & Deals - Discount Promos, Coupon Codes, Discount deals and web site reviews
 

Author Topic: browser javascript to detect if the browser is MAC Firefox and to load a gif  (Read 3485 times)

0 Members and 1 Guest are viewing this topic.

Offline idaba

  • Newbie
  • *
  • Posts: 9
    • View Profile
I need an inline browser javascript to detect if the browser is MAC
Firefox and to load a gif.  If not mac firefox load an SWF.

eg:

detect if Mac firefox if yes load src="/content/flash/WYD03.gif"

if other browser load src="/content/flash/WYD03.swf"

is this possible?

I would need it to be in the code NOT in the header as there are
several swf's on one page and Mac Firefox is making the SWF on top of
all other divs therefore not displaying the divs.

see the problem here beamcreative.com/menutest.aspx

index does not work with .swf files.  I have a work around for all
other browsers but Mac/Firefox has a bug that prevents SWF files to be
at the bottom layer.

Webmaster Forum


Offline chitika

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
The JavaScript Navigator object contains all information about the visitor's browser.
appName -  holds the name of the browser
appVersion - holds, among other things, the version of the browser

Try this:
Code: [Select]
var browser=navigator.appName;
if (browser=="Netscape"){ //do your stuff}
if (browser=="Microsoft Internet Explorer"){ //do your stuff}

i hope this will help

Offline idaba

  • Newbie
  • *
  • Posts: 9
    • View Profile
Thanks for help

how this script know mac firefox or not?

thank you

Offline David

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
alert(navigator.appName);

Execute this script in mac firefox. you will get the value required. Use that value in if statement.
suppose navigator.appName returns "Mac FireFox" than if statement should be
if(browser= "Mac FireFox"){// I dont have mac so i cant tell you exact value for mac firefox
// your code....
}

Offline Sara Sonnet

  • Jr. Member
  • **
  • Posts: 72
    • View Profile
Visit this page. Very nice tutorial

http://www.quirksmode.org/js/detect.html

Offline aashleyy12

  • Jr. Member
  • **
  • Posts: 13
    • View Profile
The JavaScript Navigator object contains all information about the visitor's browser.
appName -  holds the name of the browser
___________________________________
Hotel Italy
Apartments Italy

proximityinfotech4

  • Guest
I shall await with eager anticipation to watch your times tumble:P
Good luck with the new pedals I am sure that they will make racing more pleasurable

« Last Edit: July 16, 2010, 10:22:31 PM by seochapter »

Webmaster Forum