homepage Welcome to WebmasterWorld Guest from 54.161.192.130
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
How do I stop a certain javascript working on the Mac?
stop a script workin in mac browsers
Googly

10+ Year Member



 
Msg#: 242 posted 3:11 pm on Dec 10, 2002 (gmt 0)

Can anyone tell me what i can add to a javascript function to stop it working on mac browsers?

Cheers
Googly

 

ytswy

10+ Year Member



 
Msg#: 242 posted 3:22 pm on Dec 10, 2002 (gmt 0)

I found this somewhere I forget where.

Use the condition:
if (navigator.appVersion.indexOf('Mac')!= -1)

This will evaluate as true on Macs, otherwise false [disclaimer: I haven't tested it fully since I didn't implement it]

SethCall

10+ Year Member



 
Msg#: 242 posted 3:24 pm on Dec 10, 2002 (gmt 0)

Well, the main site that contains the "ultimate browser sniffer" script (which is very good) is on netscape, and at this time, it seems to be gone ;(

So I believe I found the same script at this site

[ksu.edu...]

the meat of the script you are looking for is a bit farther down.

Googly

10+ Year Member



 
Msg#: 242 posted 4:28 pm on Dec 10, 2002 (gmt 0)

Blimey! I just re-read the title I put in for this thread! BACK? and MAC! A bit different! Must be one of those days!

Googly

Googly

10+ Year Member



 
Msg#: 242 posted 5:25 pm on Dec 10, 2002 (gmt 0)

Okay sorry, but i've tried and failed. I'm not exactly great at understanding javascript. Could someone be kind enough to add the required code below to make sure it doesn't work on a Mac.

function toggleVisibility(id, NNtype, IEtype, WC3type) {
if (document.getElementById) {
eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
} else {
if (document.layers) {
document.layers[id].visibility = NNtype;
} else {
if (document.all) {
eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
}
}
}
}

Cheers
Googly

korkus2000

WebmasterWorld Senior Member korkus2000 us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 242 posted 6:22 pm on Dec 10, 2002 (gmt 0)

if (navigator.appVersion.indexOf('Mac')!= -1){
alert("Wow, you use a Mac!");
}else{

function toggleVisibility(id, NNtype, IEtype, WC3type) {
if (document.getElementById) {
eval("document.getElementById(id).style.visibility = \"" + WC3type + "\"");
} else {
if (document.layers) {
document.layers[id].visibility = NNtype;
} else {
if (document.all) {
eval("document.all." + id + ".style.visibility = \"" + IEtype + "\"");
}}}}}

SethCall

10+ Year Member



 
Msg#: 242 posted 9:00 pm on Dec 10, 2002 (gmt 0)

or maybe

var MacIsNotPresent = 1; //this variable should be global, so //your other javascript can find out if it should execute or //not

function setMacPresense(){
if (navigator.appVersion.indexOf('Mac')!= -1)
MacIsNotPresent=0; //or false
}

funtion JustAnExample(){
//then, you could prepend all your other scripts with:

if(MacIsNotPresent){
//****do all your Windows/Linux stuff***
}else{
//do all your Mac stuff (which is nothing, in this
//case)
}
}
<body onload="setMacPresense();">

i guess this should do it!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved