In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces what is the function of "#" in URL. In daily operation, I believe that many people "#"in URL?" There are doubts about the function of the & "number". The editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods, hoping to help you answer the doubts about "#" in URL? "&" what is the function of the number? Next, please follow the editor to study!
Url has +, space, /,?,%, #, &, = and other special symbols, may not be able to get the correct parameter values on the server side, or cause the file can not be downloaded normally (as a Download Url), what to do? The solution: you need to convert these characters into characters that the server can recognize; but why is there a problem with these characters in Url? This involves the encoding and decoding of URL.
URL encoding and decoding
Generally speaking, URL can only use English letters, Arabic numerals and some punctuation marks, but cannot use other words and symbols. Url is encoded in ASCII code instead of Unicode, which means you can't include any non-ASCII characters in Url, such as the Greek letter or Chinese. For example, the world has the English alphabet http://www.abc.com, but not the Greek alphabet http://www.a β gamma. Com (pronounced alpha-beta-gamma. Com). This is because the network standard RFC 1738 makes it mandatory:
Only letters and numbers [0-9a-zA-Z], some special symbols "$- _ +! *'()," [excluding double quotes], and certain reserved words can be used directly with URL without encoding.
This means that if there are Chinese characters in URL, such as special characters, they must be used after coding. And +, spaces, /,?,%, #, &, =, these characters (unsafe), when placed directly in Url, may cause ambiguity in the parser, so they must also be encoded before they can be used.
Solution.
Convert these characters into characters that can be recognized by the server. The corresponding relationship is as follows:
Special characters represent meaning replacement content + sign in URL indicates space% 2B space URL space can be separated by + sign or code% 20 / separate directory and subdirectory% 2F? Separates the actual URL from the parameter% 3F% specified special character 25% # indicates the delimiter between the parameters specified in the bookmark% 23&URL, the value% 3D of the parameter specified in% 26=URL, for example, http://127.0.0.1:8080/mgWeb/login.do?type=jxemisLogin&url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002&is_timeout=&is_history=no&staffId=*** in a SSO function I do here * url= http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002&is_timeout=&is_history=nourl= contains the & symbol can be replaced with% 26 & modified: http://127.0.0.1:8080/mgWeb/login.do?type=jxemisLogin&url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002%26is_timeout=%26is_history=no&staffId=******url=http://localhost:8080 / Shopping hand adminplet jxncOrderroomqryOrderDetail.docoolorderroomidcharacters 17347001822420000002% 26issteps timeoutflows% 26isshipping timeoutlines
1. #
In September, 2010, twitter was revised. A significant change is that URL has added "#!" Symbols. For example, after the URL of the user's home page before the revision is http://twitter.com/username, it becomes http://twitter.com/#!/username.
This is the first time that major websites have used "#" on a large scale in a major URL. This shows that the role of the pound sign (Hash) is being rerecognized. According to the article of HttpWatch, this paper collates all the important knowledge points related to the pound sign.
I. the meaning of
# represents a location on a web page. The character to the right of it is the identifier of that location. For example, http://www.example.com/index.html#print represents the print location of a web page's index.html. After the browser reads the URL, it automatically scrolls the print position to the visual area.
There are two ways to specify an identifier for a page location. One is to use anchor points, for example, and the other is to use the id attribute, such as. Demo
2. The HTTP request does not include #
# is used to guide browser actions and is completely useless on the server side. Therefore, # is not included in the HTTP request.
For example, visit the following URL, http://www.example.com/index.html#print, and the actual request from the browser is as follows:
GET / index.html HTTP/1.1
Host: www.example.com
Third, the character after #
Any character that appears after the first # is interpreted by the browser as a location identifier. This means that none of these characters will be sent to the server.
For example, the following URL is intended to specify a color value: http://www.example.com/?color=#fff, but the actual request from the browser is:
GET /? color= HTTP/1.1
Host: www.example.com
Fourth, change # does not trigger web page reloading
Just change the part after #, the browser will only scroll to the appropriate location, will not reload the web page.
For example, if you change from http://www.example.com/index.html#location1 to http://www.example.com/index.html#location2, the browser will not re-request index.html from the server.
5. Changing # will change the browser's access history
Each time you change the section after #, you will add a record to the browser's access history and use the "back" button to return to the previous position. This is particularly useful for ajax applications, where you can use different # values to represent different access states, and then give the user a link to a certain state. It is worth noting that the above rules do not apply to IE 6 and IE 7, which will not increase the historical record as a result of the change in #.
6. _ window.location.hash reads the # value
The attribute _ window.location.hash is readable and writable. When reading, it can be used to determine whether the state of the web page has changed; when writing, it will create an access history without reloading the web page.
VII. Onhashchange event
This is a new event in HTML 5, which is triggered when the value of # changes. IE8+, Firefox 3.6 +, Chrome 5 +, Safari 4.0 + support this event.
It can be used in three ways:
_ window.onhashchange = func;window.addEventListener ("hashchange", func, false)
For browsers that do not support onhashchange, you can use setInterval to monitor location.hash changes.
VIII. The mechanism of Google crawling #
By default, Google's web spiders ignore the # part of URL
However, Google also stipulates that if you want the content generated by Ajax to be read by the browsing engine, then "#!" can be used in URL, and Google will automatically convert the following content to the value of the query string _ escaped_fragment_.
For example, Google found that the new version of twitter's URL: http://twitter.com/#!/username
Will automatically grab another URL: http://twitter.com/?_escaped_fragment_=/username.
Through this mechanism, Google can index dynamic Ajax content.
Note
AJAX = Asynchronous JavaScript and XML (a subset of the standard generic markup language). AJAX is a technology for creating fast dynamic web pages.
2.?
1) connection: for example
Http://www.xxx.com/Show.asp?id=77&nameid=2905210001&page=1
2) clear the cache: for example
Http://www.xxxxx.com/index.html
Http://www.xxxxx.com/index.html?test123123
The two url open pages are the same, but the latter one has a question mark, indicating that instead of calling the cached content, it is thought to be a new address and re-read.
3. &
Spacers for different parameters
At this point, the study of "what is the function of" # "in URL" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.