javascript - Why can hash be used for route jumps but not refresh the page?
过去多啦不再A梦
过去多啦不再A梦 2017-06-13 09:24:20
0
5
945

What is the principle of hash

This is not about the principle of implementing hash routing. I know how to implement it. What I want to know is why hash can be done

过去多啦不再A梦
过去多啦不再A梦

reply all(5)
巴扎黑

Just follow the http protocol...

迷茫

The principle is that the modification of the hash will not cause the browser to refresh. This is the most fundamental reason. If there are other attributes modified on the URL, it will not cause a refresh. It can also be used for routing. It’s that simple

大家讲道理

This is originally the anchor information within the page, used for jumping within the page, such as Baidu Encyclopedia. The content behind the link description
# represents the id of the anchor point. When this information exists, it will jump to the anchor point specified on the page. If you look at the Dom structure, you can see the following

ps://wapbaike.baidu.com/item/http/243074?adapt=1&fr=aladdin#u0

代言

It started out as an anchor point and was used as a non-refresh jump

洪涛

The advantage of this is that it can implement front-end routing, refer to /a/11... As for why it can be achieved, it is because the internal design of the browser is like this. Modify the hash and the browser will not jump.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!