4

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

kapex
30.2k6 gold badges117 silver badges128 bronze badges
asked Sep 5, 2013 at 15:29
3
  • Whatever feature you are trying to implement - it seems like a bad idea to react or rely on things the user may does outside of your web page. If you really want to do that you'd need to create a browser plugin. Commented Sep 5, 2013 at 15:37
  • Thanks mate for Lead and i guess Browser plugin for this requirement can not be created in client or server web scripting languges any idea on this Commented Sep 5, 2013 at 15:41
  • Maybe something like this is sufficient: detect if user changes tab. Commented Sep 5, 2013 at 15:45

2 Answers 2

2

Unfortunately, you cannot tell when the user is interacting with the address bar.

answered Sep 5, 2013 at 15:32
Sign up to request clarification or add additional context in comments.

2 Comments

So there is no way to detect if user actually clicked on browser address bar?
No, all you know is that their mouse left the browser window.
0

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.

answered Sep 18, 2023 at 18:13

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.