且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

是双正斜杠的URL散列片段确定

更新时间:2023-02-23 10:54:18

我觉得 pushState的和其他历史API方法都这么初生的标准还没有进化。至于打开重新利用的新的Web井号上最近W3工作一>:

I think that pushState and the other History API methods are so nascent that standards haven't yet evolved. As opens a recent W3 work on Repurposing the Hash Sign for the New Web:

在一个URI的哈希符号(#)原本是用来引进一个静态
  片段标识符,但最近它正在更多的使用
  因为它是由设置和跨$ P $由JavaScript的Web PTED复杂的方式
  应用程序。

The Hash sign (#) in a URI was originally used to introduce a static "fragment identifier", but recently it is being used in many more complex ways as it is set by and interpreted by JavaScript in Web applications.

这可能违反正常行为的路径用双斜线但散列片段可以是任意的字符串。做一个的typeof ,你会发现它只是一个普通的字符串。这不是标准,因此可能会疏远典型的用户体验。 code明智的,不过,我觉得你可以随时给你双斜线,斜线三倍,或其他任何东西。

It might violate normal behavior to use double slashes in the pathname but the hash fragment can be any arbitrary string. Do a typeof and you'll see it's just a normal string. It's not standard and therefore might alienate the typical user experience. Code wise, however, I think you can feel free to you double slashes, triple slashes, or anything else.

有一点要记住的是,转义字符一>从 window.location.hash 属性读取时都去codeD。

One thing to keep in mind is that escaped characters are decoded when read from the window.location.hash property.