PDA

View Full Version : Mac JavaScript Check Problem


simon315
06-04-2002, 08:39 PM
Hi. I tried to write a code that would check to see if the the computer being used was a Mac and if so, clicking on a link would open a window at a certain width, and if it wasn't mac it would, clicking on that same link would open a window at a different width. Here is the code:

if ((navigator.appVersion.indexOf("Mac") != -1))
{
function openmedium(url)
{
nwW = window.open(url,"openmedium","toolbar=no,scrollbars=yes,width=516,height=400")
}
}
else
{
function openmedium(url)
{
nwW = window.open(url,"openmedium","toolbar=no,scrollbars=yes,width=316,height=400")
}
}

Why doesn't it work? Thanks!

Jon Hanlon
06-05-2002, 06:28 PM
Change:
if ((navigator.appVersion.indexOf("Mac") != -1))

To be:
if ((navigator.userAgent.indexOf("Mac") != -1))