PDA

View Full Version : Disable a certain javascript for an operating system?


photography
04-06-2008, 01:17 PM
Hello everyone,

I've discovered that on linux image_fade.js from simplicious templates has a strange behavior. In Windows everything is smooth, but on linux is a real headache, an image needs ~10 seconds to appear.

Is there a way to test if the user uses linux and to use that .js in case he does?

Thanks!

photography
04-06-2008, 02:40 PM
*solved using jfgi method*

var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";

document.write('Your OS: '+OSName);


Now I have in image_fade.js something like this:

function initImage() {
if (navigator.appVersion.indexOf("Win")!=-1) {
imageId = 'photo';
image = document.getElementById(imageId);
setOpacity(image, 0);
image.style.visibility = "visible";
fadeIn(imageId,0);
}

else
{
imageId = 'photo';
image = document.getElementById(imageId);
setOpacity(image, 100)
image.style.visibility = "visible";
}

}

i hope will be useful for someone. :)