views:

101

answers:

2

Hello

In firefox I have opened a locally stored file with the file:// protocol (file:///c:/temp/foo.html)

foo.html contains Java Script which (among others) is supposed a new window without URL:

var new_window = window.open("","", "height=100,left=50,width=200");

When this line is reached, Firefox displays this "Firefox prevented this site from opening a pop-up window". I don't understand why Firefox gives this warning, obviously, the file (foo.html) is under my control (since it's stored locally and I have opened it with the file:// protocol, and, additionally, the window to be opened doesn't point to any file that could contain any sensitive data, as the url parameter in the open method is set to "".

But besides all this, it seems I can't even force or allow firefox to open the window anyway. There's this "options" button on the yellow "Firefox prev...." bar which supposedly should allow to create exceptions, yet I can't.

So, the question basically boils down to: how can I allow a local html file to open an empty window with Javascript within Firefox.

Thanks / Rene

+1  A: 

This is a Firefox security precaution, see this link:

http://kb.mozillazine.org/Links_to_local_pages_don't_work

However, it looks like this extension will allow you to override it:

https://addons.mozilla.org/en-US/firefox/addon/281

Mark B
yes... but I am not linking (or opening for that matter) a local file, the url that I open is "".
René Nyffenegger
Even if I go like window.open("about:blank",.... it wouldn't allow me to do so.
René Nyffenegger
It still applies, because Firefox will treat that blank URL as a local file coming from a different domain. Have you tried the extension?
Mark B
A: 

This is the popup blocker, which block popups not opened by an explicit user action like a click. You cannot force it to open the popup, you need to allow Firefox to open it. I suggest you to test the new_window variable to see if it is null. In this case, display a message to the user so that he allows the domain to open popup windows.

Fabien Ménager
I am this user and I already know that I want to have Firefox open the window but since the freshly opened window has no domain and nothing associated with it, I cannot tell Firefox to please let me do what I want.
René Nyffenegger