Welcome to WebmasterWorld Guest from 54.211.227.36

Forum Moderators: open

Message Too Old, No Replies

How do I stop a certain javascript working on the Mac?

stop a script workin in mac browsers

     

Googly

3:11 pm on Dec 10, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


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

Cheers
Googly

3:22 pm on Dec 10, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:June 25, 2002
posts:466
votes: 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]

3:24 pm on Dec 10, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 24, 2002
posts:364
votes: 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

4:28 pm on Dec 10, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


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

5:25 pm on Dec 10, 2002 (gmt 0)

Inactive Member
Account Expired

 
 


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

6:22 pm on Dec 10, 2002 (gmt 0)

Senior Member

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

joined:Mar 20, 2002
posts:3732
votes: 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 + "\"");
}}}}}
9:00 pm on Dec 10, 2002 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 24, 2002
posts:364
votes: 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!

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members