I have a javascript function to log out users if they do not refresh page for 45 minutes.
But this function getting executed unexpectedly for SAFARI browser. As a workaround for this I decided to ignore this code for SAFARI browser by using a code which detect browser as mentioned below.
But the below mentioned line
also detecting CHROME as a SAFARI.
So the above code not getting executed for SAFARI as well as CHROME, But I want it to get executed for all the browser except SAFARI.
Basically, I have two requirements.
1. Function should work properly for SAFARI also
OR
2. Function should be executed for all the browser except SAFARI.
Thanks in advance.
Swapnil
Code:
(function()
{
setTimeout('newWindow()',3000000);
setTimeout('logout()', 3600000);
}());
Code:
if (navigator.userAgent.indexOf("Safari")==-1 )
{
(function()
{
setTimeout('newWindow()',3000000);
setTimeout('logout()', 3600000);
}());
}
Code:
if (navigator.userAgent.indexOf("Safari")==-1 )
So the above code not getting executed for SAFARI as well as CHROME, But I want it to get executed for all the browser except SAFARI.
Basically, I have two requirements.
1. Function should work properly for SAFARI also
OR
2. Function should be executed for all the browser except SAFARI.
Thanks in advance.
Swapnil
Comment