如何在鼠标左下角隐藏url显示?

如何在鼠标左下角隐藏url显示?,url,browser,hyperlink,Url,Browser,Hyperlink,我有一个会员的网页,其中登录是必不可少的。在这个页面上,会员可以获得讲座的链接。定期添加讲座链接。在这个页面上,可以从数据库中获取指向录制的链接,最后30个录制链接可用(通过限制$max)。 代码如下- 在这里,当用户在“播放录制”上移动光标时,他可以在浏览器的左下角看到录制链接 如何隐藏显示在鼠标左下角的链接?我可以只显示单词“录制”而不显示链接吗?您不能覆盖浏览器。就像您不能编辑或删除地址栏中显示的内容或将自定义功能绑定到后退或前进按钮一样。为此,您可以使用按钮而不是: <butto

我有一个会员的网页,其中登录是必不可少的。在这个页面上,会员可以获得讲座的链接。定期添加讲座链接。在这个页面上,可以从数据库中获取指向录制的链接,最后30个录制链接可用(通过限制$max)。 代码如下-

在这里,当用户在“播放录制”上移动光标时,他可以在浏览器的左下角看到录制链接


如何隐藏显示在鼠标左下角的链接?我可以只显示单词“录制”而不显示链接吗?

您不能覆盖浏览器。就像您不能编辑或删除地址栏中显示的内容或将自定义功能绑定到后退或前进按钮一样。

为此,您可以使用按钮而不是

<button onclick="window.location.href='location.html'">Continue</button>
继续
你的例子

<button class="class" onclick="window.location.href='<?php echo $data['recording_link'];?>'">Play Recording</button>

您只需按照按钮的建议操作,但使用您想要的锚定。也就是说,使用onclick事件而不是设置href属性。此外,您还可以向href添加noop js操作

请参阅此链接:


此函数用于将所有链接转换为隐藏悬停链接:

 $('a').each(function(){  
 $(this).attr('onclick','window.location.href="'+$(this).attr('href')+'"');
 $(this).attr('href','#');
 });

下面是实现此功能的一种方法
这有两种有效的方法

一,

点击我


并得到与之相同的结果
重新运行代码段以查看正在使用的代码,以防您错过它。。。
注意第一个按钮没有任何href属性或锚定标记(“a”标记)。


document.querySelector('a')。addEventListener('mouseover',function(){
document.querySelector('a').style.display='none';
});

检查下面的代码,它将在所有浏览器中工作

$(函数(){
$(“a”)。每个(函数(索引、元素){
var href=$(this.attr(“href”);
$(this.attr(“hiddenhref”,href);
$(this.removeAttr(“href”);
});
$(“a”)。单击(函数(){
url=$(this.attr(“hiddenhref”);
//窗口打开(url);
window.location.href=url;
})
});
ul>li>a{
字号:18px;
线高:30px;
}
ul>li>a:悬停{
颜色:#425CD2;
文字装饰:下划线!重要;
光标:指针;
}
  • 您应该这样做,因为它不会在下角显示任何URL或消息

  • 如果您使用
    javascript:void(0)
    ,那么它将在右下角显示javascript
    void(0)
    ,以代替url


  • 我不想隐藏地址abr中显示的链接。我想隐藏显示在mouseoverIt的一个类比中左下角的链接。浏览器的设计应尊重客户的隐私和偏好,而不是网站的偏好。此外,如果有人真的想查看链接,他们只需打开F12 Devtools。(您可能还想签出)我在标记中添加了php,因为php代码在href=”“中使用,当我尝试使用javascript onclick和空href时,我搞不清楚如何在onclick函数中使用这个php。php输出你的html,它无法控制onclick/hover事件。来检查我的答案,希望它能解决你的问题。是的,我现在正按照你的建议工作。执行后会让你知道我试过了…它工作完美,底部没有显示url。但用于a的类用于在fancybox中打开页面,但在Button中丢失了。我试过了…它工作完美,底部没有显示url。但用于a的类用于在fancybox中打开页面,在Button中丢失了。你能帮我吗?u提供的代码工作得很完美,在底部并没有显示url。但用于a的类用于在fancybox中打开页面,该函数在按钮中丢失。链接在父窗口中打开,人们可以在地址栏中看到链接(我想保持隐藏)。所以我的目标没有实现……那么可能你需要修复你的JavaScript和jquery,不管你使用了什么。给button一个id,用JavaScript处理onclick事件,然后执行fancyboxWhere?嘿,我回答了这个问题,显然花了一段时间,所以如果我能对这段好代码获得一些认可,那就太好了。(点击“接受答案”框)我的意思是,我已经知道一个确切的事实,如果你的按钮以前工作过,但在角落里有东西,那么当你这样做时,它肯定会工作。
     $('a').each(function(){  
     $(this).attr('onclick','window.location.href="'+$(this).attr('href')+'"');
     $(this).attr('href','#');
     });
    
    document.$('fancybox').addEventListener('click', function() { window.location.href = '<?$=data['recording_link']?>' } );
    
    //non-jquery:
    
    document.getElementsByClassName('fancybox')[0].addEventListener('click', function() { window.location.href = '<?=$data['recording_link']?>' } );
    
    <button id="Play-Recording" class="fancybox fancybox.iframe more_info_btn"> Play Recording </button>
    
    <a id="GetClickedOn" href="<?=$data['recording_link']?>"> I'm Hidden! </a>
    
    <body>
      <!--Put other stuff here or whatever-->
    
      <button id="Play-Recording" class="fancybox fancybox.iframe more_info_btn"> Play Recording </button>
    
      <!--Put some other stuff here...-->
      <!--End of other content other than hidden stuff...-->
    
      <a id="GetClickedOn" href="<?=$data['recording_link']?>" style="visibility: none; position: fixed; bottom: 3000%; width: 0; height: 0;"> I'm Hidden! </a>
    
      </body>
    
    <script>
      document.getElementById('Play-Recording').addEventListener('click', function() { document.getElementById('GetClickedOn').click() } );
    </script>
    
      <button id="Play-Recording" class="fancybox fancybox.iframe more_info_btn"> Play Recording </button>
    
      <a id="GetClickedOn" href="<?=$data['recording_link']?>" style="visibility: none; position: fixed; bottom: 3000%; width: 0; height: 0;"> I'm Hidden! </a>
    
      <script>
        document.getElementById('Play-Recording').addEventListener('click', function() { document.getElementById('GetClickedOn').click() } );
      </script>
    
    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
    <a class="fancybox etc etc etc" href="javascript:void(0)" onclick="window.location.href='<?php echo $data['recording_link'];?>'">Play Recording</a>
    
    <script>
        document.querySelector('a').addEventListener('mouseover', function(){
            document.querySelector('a').style.display = 'none';
        });
    </script>
    
    </body>
    </html>