Unexpected html anchor redirection
This question already has an answer here:
Thanks to @AmrElgarhy, I'll leave an answer to my own question here.
It's because of the <base>
element in my HTML code. For my solution I can't delete this node, but I'm going to add the request-uri to my "to-top"-anchor programmatically like this:
<header id="top">top</header>
<div style="height: 2000px"></div>
<a href="{{ request.uri }}#top">Click me</a>
Whereas {{ request.uri }}
will contain /foo
or similar.
上一篇: 锚和编号工作以引用页面上的特定部分
下一篇: 意外的html锚定重定向