【问题标题】:${documentReferrer} is empty when document.referrer is "https://www.google.com/"当 document.referrer 为“https://www.google.com/”时,${documentReferrer} 为空
【发布时间】:2017-07-15 10:38:50
【问题描述】:

通过 AMP 文档 (https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#document-referrer) 看来,documentReferrer 变量应该反映 JS document.referrer

当页面的document.referrer 值为“https://www.google.com/”@ 987654327@ 为空。我找不到任何文件表明 www.google.com 域带有任何额外的警告。

【问题讨论】:

  • 您的预期结果是什么?
  • 根据文档,我希望 AMP 文章的 documentReferrer"https://www.google.com/",而那是引用 URL。

标签: amp-html


【解决方案1】:

AMP 文档准确无误。 “https://www.google.com/”也不例外。

值得一提的是,一些 AMP 标记(如<analytics-tag>)允许您定义自定义变量以供标记内部使用。这些变量可以优先于该标记范围内的全局变量(如documentReferrer)。

有关可能发生这种情况的一种非常具体的场景的更多详细信息,请参阅:https://github.com/ampproject/amphtml/issues/10374

【讨论】:

    猜你喜欢
    • 2019-10-24
    • 2013-07-16
    • 2014-04-23
    • 2012-02-09
    • 1970-01-01
    • 2015-02-28
    • 1970-01-01
    • 2014-08-01
    • 2021-03-31
    相关资源
    最近更新 更多