【问题标题】:Invalid quotes in URLURL 中的引号无效
【发布时间】:2017-02-17 21:12:03
【问题描述】:

在我们的网站上,我们在 location.hash 中使用 JSON。这意味着我们需要在 URL 中使用引号,例如:

https://goout.net/cs/jine-akce/3-2-1-jedem/qmnub/#"T":"2017-03-15T20:00:00"

问题是the W3C validator is not happy about it

所有浏览器都很好地处理了URL,所以我想知道是验证器太严格还是我的URL被错误地转义了?

【问题讨论】:

    标签: url url-encoding w3c-validation double-quotes


    【解决方案1】:

    URL 的片段部分不允许使用引号,因此您必须使用%22 对其进行百分比编码:

    https://goout.net/cs/jine-akce/3-2-1-jedem-impro-talk-show-s-cestovatelem-danem-pribanem/qmnub/#%22T%22:%222017-03-15T20:00:00%22
    

    URL 片段部分中的有效字符列表:List of valid characters for the fragment identifier in an URL?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-05-08
      • 2020-04-04
      • 2015-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-06
      • 1970-01-01
      相关资源
      最近更新 更多