With "open in same window/tab" pref, target=_blank can exit browser




File Handling
11 years ago
2 years ago


(Reporter: Akkana Peck, Unassigned)


Firefox Tracking Flags

(Not tracked)




11 years ago
Links to mime types that require an external application can exit the current tab or window (and potentially the whole browser session) if you set your preferences so that target="_blank" opens in the current window and tab.

For example, I have:
user_pref("browser.link.open_external", 1);
user_pref("browser.link.open_newwindow", 1);

Now make a page which does this:
<a href="foo.pdf" target="_blank">click here to exit</a>
(where foo.pdf points to an actual pdf file somewhere, or some other file type that would call up the helper app dialog).

With only one window and one tab visible, click on the link.

The current window disappears, then the mime type helper app dialog appears. Sometimes you can call up the helper app, sometimes not (there might be a race condition there) but the important thing is that no matter what, you've lost your browser window.

I haven't tried this with mime types that don't display the helper app dialog.

In bug 346561 ("Always close useless tabs/windows opened for external handling") the first comment is "We already do this for windows opened through target="_blank" and window.open(...)." I suspect that the "already do this" code is being a bit too eager, and not noticing whether a new tab or window is actually opened before deleting the current one. The code should check whether it actually opened a new window, and only in that case should it close it.
Component: File Handling → File Handling
Product: Firefox → Core
QA Contact: file.handling → file-handling
Version: 2.0 Branch → Trunk
The code that closes "blank" windows after a download is in nsExternalHelperAppService (see bug 343921 and bug 241972). Also note that pref("browser.link.open_external", 1); is not "supported" by Firefox (there's no UI to set that pref to 1).
See also bug 324164, which proposes removing that pref altogether.


2 years ago
Component: File Handling → File Handling
Product: Core → Firefox
Version: Trunk → unspecified
You need to log in before you can comment on or make changes to this bug.