What does #/ means in url?

谁说胖子不能爱 提交于 2019-11-28 03:50:45

问题


I am working on ROR web apps. My webpage url looks like below-

http://dev.ibiza.jp:3000/facebook/report?advertiser_id=2102#/dashboard

Here I understood that advertiser_id is 2102 but I couldn't understand what #/dashboard is pointing to?


回答1:


The portion of the URL which follows the # symbol is not normally sent to the server in the request for the page. If you open your web inspector and watch the request for the page, you will see that the #/dashboard portion is not included in the request at all.

On a normal (basic HTML) web page, the # symbol can be used to link to a section within the page, so that the browser jumps down to that section after the page loads.

In fancy javascript-heavy web applications, the # symbol is commonly used followed by more URL paths, for example www.example.com/some-path#/other-path/etc the other-path/etc portion of the URL is not seen by the server, but is available for Javascript to read in the browser and presumably display something different based on that URL path.

So in your case, the first part of the URL is a request to the server:

http://dev.ibiza.jp:3000/facebook/report?advertiser_id=2102

and the second part of the URL could be for Javascript to display a specific view of the page once it has loaded:

#/dashboard

The # symbol is also used to create a Fragment Identifier and is also typically used to link to a specific piece of content within a web page (such as to cause the browser to jump down to a particular section on the page).

As others have mentioned, this has SEO implications. In order to index pages such as this, you may have to employ different techniques to allow the content that is "behind the # symbol" to be accessible to search engines.




回答2:


# symbol is called anchor, it redirects to a specific position on the html page.

It's a crawling technique , you could read more Here




回答3:


Providing another example

Here's a request to github for the sourcecode of a java class

https://github.com/spring-cloud/spring-cloud-consul/blob/master/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/serviceregistry/ConsulServiceRegistry.java

By appending this with "#L90" the web browser will make the same request, and then scroll to line 90 and highlight the code.

https://github.com/spring-cloud/spring-cloud-consul/blob/master/spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/serviceregistry/ConsulServiceRegistry.java#L90

Your web browser made the same request to the github server, but in the anchored case, performed the additional action of highlighting the selected line after the response was received.




回答4:


after # is the hash of the location; the ! the follows is used by search engines to help index AJAX content. After that can be anything, but is usually rendered to look as a path (hence the /)



来源:https://stackoverflow.com/questions/38909084/what-does-means-in-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!