当某些网站按下散列(#)链接时,不会向网址添加散列? [英] When hash(#) link pressed in some websites, does not add hash to url?

查看:75
本文介绍了当某些网站按下散列(#)链接时,不会向网址添加散列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在自己的网站上有散列(#)链接,并且我意识到当我点击它们时,散列符号将始终出现在我的网址末尾。但在其他网页中,我无论多少次点击了具有#来源的链接,它都不会在我的URL末尾添加散列。为什么会这样?

解决方案

它们可能已将javascript附加到阻止链接动作开始的链接上。 b
$ b

简单的

  return false; 

可以做到这一点


I have hash(#) links in my own website, and I realised that when I click on them, a hash sign will always appear at the end of my url. But in other web pages that I was fiddling around with, no matter how many times I clicked the link which had a source of '#', it would never add a hash to the end of my URL. Why is this?

解决方案

They probably have javascript attached to the link that prevents the link action from starting.

A simple

return false;

will do this

这篇关于当某些网站按下散列(#)链接时,不会向网址添加散列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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