2017-07-11 52 views
0

时,$ {documentReferrer}为空。通过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/”

虽然documentReferrer似乎汇报其他域的正确值(如:www.twitter.com,t.co,linkedin.com等)时,页面的document.referrer值是“https://www.google.com/documentReferrer是空的。我找不到任何文件表明www.google.com域名有任何额外的警告。

+0

什么是你期望的结果? – noogui

+0

基于文档,我期望AMP文章的'documentReferrer'在引用URL时是''https://www.google.com/“'。 –

回答

0

AMP文档是准确的。 “https://www.google.com/”没有例外。

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

有关一个非常特殊的情况下更多的细节,其中可能出现的看到:https://github.com/ampproject/amphtml/issues/10374