Firefox Sidebar and Document object of DOM

There is a webpage loaded in the firefox sidebar and another webpage loaded in the main document. Now, how do I ask access the main document object through the Firefox sidebar? An example to do this through Javascript code in the firefox sidebar document to access the main document would be helpful.

Thanks for the answers. I have to refine my question however. The main window has some webpage loaded and the sidebar has a webpage. I want the sidebar window to know what text the user has selected on the main window when a link on the sidebar window is clicked. I know how to get the selected text from a window. Only that the sidebar element adds complexity to the problem that I am not able to surpass.

@PConory:

I like your answer, but when I try it there is an error:

Error: Permission denied to create wrapper for object of class UnnamedClass.

Thanks.

3
2022-07-25 20:41:51
Source Share
Answers: 1

Are you attempting to write in - web page javascript that will permit interaction in between the sidebar web page and also the tab web page? There are constraints on which web pages can see each various other and also communicate:

  • If the web pages are out the very same domain name, they aren't permitted to chat (very same - domain name constraint)
  • If one web page did closed the various other, there is no other way for either web page to acquire a reference to the various other

I'm not exactly sure just how a web page can ask for the opening of a web page in the sidebar, or the other way around. Yet if you can take care of that, make use of var child = window.open(...) to get a reference one instructions and also window.opener to get a reference the various other instructions.

1
2022-07-25 20:49:40
Source