开发者

Detect for website change via javascript / jquery

开发者 https://www.devze.com 2022-12-08 16:11 出处:网络
Is it possible to check if the browser user has opened a new tab, is closing (not minimizing) the current tab/page, or changing the url? Don\'t worry, nothing suss it\'s just for a novelty website. Co

Is it possible to check if the browser user has opened a new tab, is closing (not minimizing) the current tab/page, or changing the url? Don't worry, nothing suss it's just for a novelty website. Could someone let me know if this is/isn't feasible via javascript (preferably jquery), and if so, what method to look into. Thanks

EDIT: I开发者_高级运维n the end it was easier to check if the mouse went above the window with the following code:

    $(window).bind("mouseout", function(e)
    {
    if (e.pageY < 0)
        {
            alert('you are leaving the page');
        }
    });


It is somewhat feasible using the unload event.

0

精彩评论

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