Html 为什么网站的链接没有';你不能用身份证吗?

Html 为什么网站的链接没有';你不能用身份证吗?,html,css,Html,Css,今天我在我的网站上看到: 导航按钮在个人电脑上工作,但在我的手机上不工作,同样的按钮,让你起来。我在Puffin浏览器中看到了这一点,但在Chrome上却没有。我在链接上做错了什么?是关于我的手机还是Chrome?看起来这可能是Chrome某些版本的bug。对此有更多的见解。为了节省时间,下面是使用jQuery提供的变通方法 $(document).ready(function () { var isChrome = /Chrome/.test(navigator.userAg

今天我在我的网站上看到:


导航按钮在个人电脑上工作,但在我的手机上不工作,同样的按钮,让你起来。我在Puffin浏览器中看到了这一点,但在Chrome上却没有。我在链接上做错了什么?是关于我的手机还是Chrome?

看起来这可能是Chrome某些版本的bug。对此有更多的见解。为了节省时间,下面是使用jQuery提供的变通方法

$(document).ready(function () {
        var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
        if (window.location.hash && isChrome) {
            setTimeout(function () {
                var hash = window.location.hash;
                window.location.hash = "";
                window.location.hash = hash;
            }, 300);
        }
    });
如果您想使用vanilla JS而不是jQuery,可以执行以下操作

document.addEventListener('DOMContentLoaded', function () {
        var isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
        if (window.location.hash && isChrome) {
            setTimeout(function () {
                var hash = window.location.hash;
                window.location.hash = "";
                window.location.hash = hash;
            }, 300);
        }
    });

欢迎来到Stackoverflow!请张贴不起作用的最小可复制代码。这将有助于我们更好地回答您的问题。出于上下文考虑,要求在问题中包含问题的原因:当您更新网站以使问题不再存在时,会发生什么情况?或者你完全改造了它或者移除了它?在这一点上,这个问题对于任何新来者来说都是相对无用的,因为它所基于的外部资源不再是可访问的。此外,要求个人点击场外查看问题可能是一个安全问题。基于这些原因,你的问题应该在帖子中包含足够的信息。祝你好运,快乐!