What does #/ means in url?

前端 未结 4 1581
执念已碎
执念已碎 2020-12-16 19:05

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

相关标签:
4条回答
  • 2020-12-16 19:47

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

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

    0 讨论(0)
  • 2020-12-16 19:47

    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.

    0 讨论(0)
  • 2020-12-16 19:51

    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.

    0 讨论(0)
  • 2020-12-16 19:54

    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 /)

    0 讨论(0)
提交回复
热议问题