简体   繁体   中英

Detect URl Bar click event or user typing in Browser address bar with Jquery/java-script

I am working on a project where I need to Interact with browser Url bar. I mean I need too detect event with jquery/JS as soon as user clicks on address bar or type in there or if user clicks on another tab so to use with with callback and do the stuff. I know the browser is a OS app and has its own control but is there a way to accomplish this? Right now I am just detecting if user leaves Html from upper position.

Here is the code

co$(window).mouseleave(function(e){
    if(e.pageY<5)
    {
        //do stuff;
    }
});

Any thoughts will be appreciated

不幸的是,您无法确定用户何时与地址栏进行交互。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM