PathLocationStrategy VS HashLocationStrategy在Web应用程序 [英] PathLocationStrategy vs HashLocationStrategy in web apps

查看:2010
本文介绍了PathLocationStrategy VS HashLocationStrategy在Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是使用的利弊:


  1. PathLocationStrategy - 默认的HTML 5 pushState的风格

  2. HashLocationStrategy - 在散列URL的风格

例如,使用的 HashLocationStrategy 的将prevent其#ID滚动到一个元素的功能,但一些第三方插件需要的 HashLocationStrategy 的或 Hashbang #!要想在阿贾克斯的网站工作。

for instance, using HashLocationStrategy will prevent the feature of scrolling to an element by its #ID, but some 3rd party plugins require the HashLocationStrategy or the Hashbang #! in order to work in ajax websites.

我想知道一个web应用哪一个提供了更多的。

I would like to know which one offers more for a webapp.

推荐答案

只能在客户端进行处理,服务器只是忽略它们。这会导致搜索引擎(SEO)的问题,重定向会导致多余的页面重新加载。
此页面 https://github.com/browserstate/history.js/wiki /智能型国家处理有一定的详细解释,而某些观点并不适用于角申请。(例如 - 不与JS禁用工作)

# can only be processed on the client, the servers just ignore them. This can cause problems with search engines (SEO), redirects can cause redundant page reloads. This page https://github.com/browserstate/history.js/wiki/Intelligent-State-Handling has some detailed explanation, while some of the arguments don't apply for Angular applications (for example - doesn't work with JS disabled).

在HTML5的pushState的缺点是需要服务器支持像蒂埃里解释说。

The "disadvantage" of HTML5 pushstate is that is requires server support like explained by Thierry.

这篇关于PathLocationStrategy VS HashLocationStrategy在Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆