In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly talks about "what are the differences between history and hash in vue". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the differences between history and hash in vue?"
Differences: 1. Hash routes have "#" on the address bar URL, but history routes do not; 2. When performing an enter refresh operation, hash routes will be loaded into the corresponding page of the address bar, while history routes will generally have a 404 error; 3. Hash supports some lower versions of browsers, but history does not.
This article operating environment: windows10 system, Vue2.9.6 version, DELL G3 computer.
The difference between history and hash in vue
1.hash routes have # on the address bar URL and are read with _ window.location.hash. And history routing doesn't look better.
two。 When we perform an enter refresh operation, the hash route is loaded to the page corresponding to the address bar, while the history route generally reports an error (refresh is a network request, which will be reported when there is no backend preparation).
3.hash routing supports older browsers, while history routing is a new API added by HTML5.
The characteristic of 4.hash is that although it appears in the URL, it is not included in the http request, so it has no impact on the backend, so changing the hash will not reload the page, so it is also a must for single-page applications.
5.history uses the browser's history stack, with the back,forward,go method before, and then adds the pushState () and replaceState () methods to HTML5, which provide the ability to modify the history, but when making changes, although the current URL is changed, the browser does not immediately send a request to the backend.
This mode of 6.history requires background configuration support. For example, when we work on the home page of the project, everything is fine and can be accessed, but when we refresh the page or directly access the path, we will return 404. That is because in history mode, we only dynamically change the path in the browser address bar by operating window.history through js, and do not initiate a http request, but when I enter this address directly in the browser The http request must be made to the server, but the target does not exist on the server, so 404 will be returned.
At this point, I believe you have a deeper understanding of "what is the difference between history and hash in vue". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.