一个href不会加载新页面 [英] a href does not load the new page
问题描述
我有一个< a href =/ other-page>
,当我点击它时,地址栏变为 mysite .com / other-page
但不会加载它...
我需要右键单击然后打开链接到新标签以真正打开所需页面。
我认为这是Chrome的一个漏洞,但我在IE(11)和它的行为类似......
这种奇怪行为的原因是什么?
PS。我不使用(至少,故意),也不想使用任何浏览器历史操作。我只需要在同一页面中经常打开一个简单的链接,这是我所需要的! 解决方案
我发现问题是因为容器的位置:fixed
和 z-index:1
...
绝对或固定头寸可以与z-index> 0结合使用可能会导致这类问题。
要改变容器的显示位置,我的解决方案是破解href行为:
< a href =/ myurlonclick =parent.location ='/ myurl'; return false;>
显示更多...
< / a>
I have an <a href="/other-page">
that when I click on it changes the address bar to mysite.com/other-page
but does not load it...
I need to do right-click and then open the link in new tab in order to really open the desired page.
I thought that is a bug of Chrome, but I tested in IE(11) and it behaves similarly...
What could be the cause of this "strange" behavior?
PS. I don't use (at least, intentionally) and don't want to use, any browser history manipulations. I just need to classically open a simple link in the same page, it's all I need!
I found that the problem was because of the position:fixed
and the z-index: 1
of the container...
The absolute or fixed positions could combined with the z-index > 0 could cause this kind of problems.
As I didn't want to change the display position of the container, my solution was to "hack" the href behavior:
<a href="/myurl" onclick="parent.location='/myurl'; return false;">
show more...
</a>
这篇关于一个href不会加载新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!