Amir
Amir

Reputation: 1259

open new window from firefox extension gets Access denied

I'm writing a firefox extension. In this extension i need to open a new tab to display some analytics and data. I have a template html file which i placed in my chrome/content folder.

When i try the following code:

var w = content.window.open("chrome://myplugin/content/search.html","My Plugin");

i get the following error:

Access to 'chrome://myplugin/content/search.html' from script denied

is there a way to open a new window and to set its URL to a file in the chrome directory? or is there a better way to load the content into a new window?

Upvotes: 1

Views: 2529

Answers (1)

sdwilsh
sdwilsh

Reputation: 4682

Your problem is content before window. This means that you are using the content's window object, which does not have permission to open a chrome URI. In this case, you just want this:

var w = window.open("chrome://myplugin/content/search.html","My Plugin");

Upvotes: 3

Related Questions