[英]Not able to access firefox page from extension
I have created an add-on using firefox's add-on builder. 我已经使用firefox的插件生成器创建了插件。 I am able to create a javascript file inside add-on and can invoke a function when a user clicks on the button provided by addon.
我能够在附加组件内部创建一个javascript文件,并且当用户单击附加组件提供的按钮时可以调用一个函数。
The problem is I am not able to access firefox's webpage from that javascript file. 问题是我无法从该javascript文件访问firefox的网页。 When I access "document" object, it seems to be different object.
当我访问“文档”对象时,它似乎是不同的对象。 And window.location is shown to be "chrome://browser/content/browser.xul"
并且window.location显示为“ chrome://browser/content/browser.xul”
Please suggest me how to make javascript access main page. 请建议我如何使javascript访问主页。
Thanks 谢谢
There are various ways, eg: 有多种方法,例如:
gBrowser.contentDocument
(see Tabbed Browser ) gBrowser.contentDocument
(请参阅选项卡式浏览器 ) window.content
(rsvp window.content.document
) window.content
(rsvp window.content.document
) window
in a script refers to the Firefox window. window
中的脚本是指Firefox窗口。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.