Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否可以为带有哈希的 URL 设置唯一的标题标签。
例如,我可以为这个页面设置一个标题:
http://somesite.com
然后为这个网址设置一个单独的标题:
http://somesite.com#something
提前致谢!
这应该会有所帮助:
<html> <head> <title>Test Title</title> <script type="text/javascript"> var url =document.URL; if(url.indexOf('#')!=-1){ document.title = "This is the new page title."; } </script> </head> <body> <a href="?#something">SomeLink</a> </body> </html>