使用自定义引荐来源网址打开选项卡
如何在 Firefox 插件中打开带有自定义引荐来源网址的选项卡?
我猜是这样的:
tab.addProperty("referer", "http://mywebsite.com/");
How can I open a tab with a custom referrer in a Firefox add-on?
I guess something like that:
tab.addProperty("referer", "http://mywebsite.com/");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您无法将引荐来源网址“添加”到已打开的选项卡,需要在打开选项卡时指定引荐来源网址。您使用
gBrowser.addTab()
方法为此:gBrowser
是浏览器窗口中的全局变量。如果您没有浏览器窗口,可以使用 nsIWindowMediator.getMostRecentWindow( ) 为此:You cannot "add" a referrer to an already open tab, the referrer needs to be specified when the tab is opened. You use
gBrowser.addTab()
method for that:gBrowser
is a global variable in the browser window. If you don't have the browser window, you can use nsIWindowMediator.getMostRecentWindow() for that:您需要先创建一个 URI:
享受吧!
You need to create a URI first:
Enjoy !