开发者

How can I load a new page when the iPhone/Android browser is reopened?

Okay, so I don't exactly even know how to word this question properly as you can probably tell. Hence I couldn't find any solution on Google, so I开发者_开发知识库 came here.

Basically, the process unfolds like this:

1.) The user logs into my site. 2.) The user uses my site, then leaves the browser and does whatever else, without killing the browser. 3.) The user opens up the browser again to check my site again.

When 3.) triggers, I want my site to detect that and forward the browser to some other page.

Does this make any sense? If you need clarification, just let me know. I believe there has to be a way to do this with jQuery or maybe just plain JS.

Thanks!


function onBlur() {
    document.body.className = 'blurred';
};
function onFocus(){
    document.body.className = 'focused';
};

if (/*@cc_on!@*/false) { // check for Internet Explorer
    document.onfocusin = onFocus;
    document.onfocusout = onBlur;
} else {
    window.onfocus = onFocus;
    window.onblur = onBlur;
}

Reference: Is there a way to detect if a browser window is not currently active?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜