开发者

Detect focus on browser address bar?

开发者 https://www.devze.com 2022-12-24 14:39 出处:网络
Is there a way to detect when focus has been put onto the address-bar or the browser-search-bar? I ask because I am trying to keep focus on one element in my document, but adding a blur() listener to

Is there a way to detect when focus has been put onto the address-bar or the browser-search-bar?

I ask because I am trying to keep focus on one element in my document, but adding a blur() listener to that element (which calls focus() on that same element) w开发者_JS百科orks too well in Safari Mac -- you can't put focus on the address-bar when you setFocus with a timeout of 0 (necessary for a plugin).


No, it is not possible


You can only work with the DOM.

If you want to access address bar, you need a control running in the browser or your own toolbar.


why not check when the desired element has lost focus? and work your way from there? and what i meant was using the .focusout() event, instead of .blur() since it behaves different.

http://api.jquery.com/focusout/

0

精彩评论

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