如何在 Firefox 插件中可靠地找到请求的引荐来源网址?
我在 nsIHttpChannel 上找到了referrer 属性,这在大多数情况下都有效,但这仅在某些安全检查的情况下进行设置(例如,如果您从 HTTPS 导航到HTTP URL)。
我可以看到可以获取加载上下文(nsILoadContext
),并通过它获取关联窗口之类的内容,但我找不到通过这些内容查找引荐来源网址信息的方法。
所以我的问题是这样的;对于那些具有引用 URL 但未通过 nsIHttpChannel
引用者属性上存在的安全检查的请求,是否有办法获取引用者信息?
I've found the referrer attribute on nsIHttpChannel
and this works most of the time but this is only set subject to certain security checks (e.g. it won't be set if you're navigating from an HTTPS to an HTTP URL).
I can see that it's possible to get the load context (nsILoadContext
) and, through that, things like the associated window but I can't find a way of finding the referrer information through these.
So my question is this; for those requests which have a referring URL but which don't pass the security checks present on the nsIHttpChannel
referrer attribute, is there a way of obtaining the referrer information?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
即使在未发送
Referer
标头的情况下,Gecko 也会将引荐来源网址保存在docshell.internalReferrer
属性中。在大多数情况下,您应该能够读出像这样的推荐人信息:Gecko saves the referrer in the
docshell.internalReferrer
property even in the cases where theReferer
header isn't sent. In most cases you should be able to read out referrer information like this: