使用jQuery/java-script检测URl Bar单击事件或用户在浏览器地址栏中键入 [英] Detect URl Bar click event or user typing in Browser address bar with Jquery/java-script

查看:60
本文介绍了使用jQuery/java-script检测URl Bar单击事件或用户在浏览器地址栏中键入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在一个需要与浏览器网址栏进行交互的项目.我的意思是,一旦用户单击地址栏或在其中键入内容,或者如果用户单击另一个选项卡以便与回调一起使用,则我也需要使用jquery/JS来检测事件.我知道浏览器是一个OS应用程序,并且具有自己的控件,但是有没有办法做到这一点?现在,我只是在检测用户是否从较高位置离开HTML.

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.

这是代码

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

任何想法都会受到赞赏

推荐答案

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

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

这篇关于使用jQuery/java-script检测URl Bar单击事件或用户在浏览器地址栏中键入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆