html5 mode and hash mode of history

Intuitive difference

hash       带一个#
history    没有#

Their characteristics

hash:        仅 hash 符号之前的内容会被包含在请求中,**因此对于后端来说,即使没有做到对路由的全覆盖,也不会返回 404 错误。**(这就是前端人员比较喜欢的,不用出404)
history:     前端的 URL 必须和实际向后端发起请求的 URL 一致,如 http://www.abc.com/book/id。    
如果后端缺少对 /book/id 的路由处理,将返回 404 错误。

Guess you like

Origin www.cnblogs.com/whyaza/p/11613507.html