Possible Duplicate:
How to detect in iOS webapp when switching back to Safari from background?
In one of my web page , I have written one javascript which is like below:
function onBlur() {
window_focus = false;
};
function onFocus() {
window_focus = true;
};
if (/*@cc_on!@*/false) { // for Internet Explorer
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onfocus = onFocus;
window.onblur = onBlur;
}
setInterval(function () { $('body').append('Your window has focus? ' + window_focus + '<br>'); }, 1000);
This is working fine, when I check in all browser, but when I check iOS device(iPhone/iPad). it gives me "window_focus" == undefined.
Where am going wrong?
and in another page I am doing below:
function CheckIOS(){ document.location = 'custom URL'; setTimeout(function(){document.location='http://www.test.com'},1000);}
In this, if application is installed in ios device than it will open that app and should not redirect to "www.test.com" other wise it should redirect to "www.test.com".
Is there any way to do this?
Thanks in advance,
Sagar Joshi