Open a new window and write to him in the development of the Firefox extension

I am developing a Firefox extension that will retrieve bibliographic information from a specific site, and when a user clicks on the firefox "extension" button, a new window should appear with the bibliography data.

My problem is that I opened a new window with JS and wrote him the usual JS code:

NewWin=window.open("","NewWin","toolbar=no,status=no,width=600,height=200");
  NewWin.document.write("<b>Test</b>");

but i have a mistake

Error: uncaught exception: [Exception... "Security error"  code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)"  location: "chrome://custombutton/content/button.js Line: 5"]

any proposed solution on how to open a new window and write new information into it and extract information from the document.

I checked my code on the bookmarklet, and when I wanted to convert the firefox extension, I ran into this problem.

This is my first time developing an extension. so any help I really like.

thank.

+3

Source: https://habr.com/ru/post/1758482/


All Articles