简体   繁体   English

href#没有追加到URL的末尾

[英]href # is not appending to end of URL

href # is not appending to end of URL href#没有追加到URL的末尾

I have written the html page on which one of the anchor tag has href "#". 我已经写了一个html页面,其中一个锚标记具有href“#”。 Whenever I am clicking on it, # is not appending at the end of URL path in browser. 每当我单击它时,#都不会附加在浏览器中URL路径的末尾。 Same functionality is working in different websites. 相同的功能在不同的网站上运行。 Please suggest.. 请建议..

<li class="nav-item d-md-down-none">
      <a class="nav-link" href="#">
        <i class="icon-location-pin"></i>
      </a>
    </li>

My current url is "http://localhost:8080/add/AddDocument.html" 我当前的网址是"http://localhost:8080/add/AddDocument.html"

After clicking on the link i should get "http://localhost:8080/add/AddDocument.html#" 单击链接后,我应该得到"http://localhost:8080/add/AddDocument.html#"

But i am getting this "http://localhost:8080/add/#" 但是我得到这个"http://localhost:8080/add/#"

This issue is solved. 这个问题解决了。

There is <base href=”/”> tag present in my html which was loading alternative html link while clicking on href="#" . 我的html中存在<base href=”/”>标记,该标记在单击href="#"时正在加载备用html链接。

Thanks for all your help. 感谢你的帮助。

Usually, it is to link to part of a page ('#about') . 通常,它是链接到页面的一部分('#about') If it is just there instead of being empty('#' vs. '') , it prevents the page from being reloaded on click. 如果它只是在那里而不是为empty('#' vs. '') ,则它会阻止在单击时重新加载页面。

Normally, you define it like this: 通常,您可以这样定义它:

<a href="#about"></a>
<div id="about"></a>

In order for your href to have a clickable link ie a web address, by placing the hashtag symbol, you refer the element (image,text, video etc) as a href if the website link is either not yet available or if it's in the same page you can use the hashtag followed by the id name. 为了使href拥有可点击的链接,即网址,通过放置井号标签,如果网站链接尚不可用或在网站链接中,则将元素(图像,文本,视频等)称为href 。您可以在同一页面上使用#标签,后跟ID名称。

Also please check your routing. 另外,请检查您的路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM