Reputation: 41
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
Upvotes: 4
Views: 3333
Reputation: 11
The only way to handle this is using $(window).bind('beforeunload', function (e) { your code here });
But again it will not tell you which key is pressed. It will only gets called upon reload the page, refresh the page and browser close.
Upvotes: 0
Reputation: 161457
Unfortunately, you cannot tell when the user is interacting with the address bar.
Upvotes: 2