Closed Bug 149637 Opened 24 years ago Closed 24 years ago

Clicking on a PDF link shouldn't open a new (empty) browser window if it's just going to launch Acrobat, anyway

Categories

(Core :: DOM: Navigation, enhancement)

PowerPC
macOS
enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: kbh7, Assigned: adamlock)

References

()

Details

From Bugzilla Helper: User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0+) Gecko/20020603 BuildID: 2002060303 Many web pages have links to PDF files as <a href="blah.pdf" target="_blank">. If you have a Mozilla plugin to handle PDFs in the browser, this opens it in a new window, making you feel like you're in Acrobat now. If you don't have such a plugin, and Acrobat really does get launched, you're stuck with an empty browser window. It gets tiring to close these all the time. Reproducible: Always Steps to Reproduce: 1. Start Mozilla; disable/remove the Acrobat-the-plug-in, if you have it, so Acrobat-the-applications gets used 2. Go to http://www.jsoftware.com/home.htm 3. Click on "Statistical Calculations with ease..." Actual Results: A new, empty browser window is opened, and then the PDF opens in Acrobat. Expected Results: Mozilla should be smart, and realize target=_blank on a PDF shouldn't open a new window if it's just going to hand the PDF to a helper app. This probably applies to filetypes/applications other than just PDF/Acrobat, but the use of this idiom for PDFs is by far the most prevalent.
This is a docshell issue... the new window is created before file handling ever knows something is going on.
Assignee: law → adamlock
Status: UNCONFIRMED → NEW
Component: File Handling → Embedding: Docshell
Ever confirmed: true
QA Contact: sairuh → adamlock
I have seen this on Windows & Unix. Suggest it should be flagged as platform/os all
Marking WONTFIX Unfortunately I don't think there is much can be done about this. The new window is opened while waiting for the content to arrive. It isn't until the content type appears in the response that it knows to hand it off to an external app helper. IE on Win32 & Mac does the same thing too.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → WONTFIX
So why not close the new empty window after the content starts to arrive? (Download windows sometimes appear for just a second.) We don't know how to do the right thing immediately, perhaps, but we'll know pretty darn soon, so we should correct it as soon as we know we screwed up. Or maybe: if the link is to a filename matching "*.pdf" don't open a new window until/unless it turns out to really be HTML. I'll bet my lunch that's a very rare case (HTML files with *.pdf filenames) -- and making the user experience better in the vast majority of cases at the expense of a very rare case is a Good Thing. (Actually, it's not really worse in the rare case, either, since you're just not showing a blank window as soon -- the content is displayed as soon as it arrives, either way.) "This is bad, but IE does it too" is just an excuse, and a lousy one at that. I shouldn't have to point out everything that's wrong with that.
The point I'm trying to make is that targetted anchors to PDF files is a non-fatal edge case. It's a minor nuisance at best and not one that warrants rearchitecting the docshell to sort out. Closing the window, or looking for .pdf extensions (which means nothing in the context of an url), or hiding windows until the content arrives will cause bigger problems than they solve. I much prefer to mark this WONTFIX unless there is a simple and clean way to sort the issue out. I can't think of one off-hand. Clearly the IE engineers thought the same way. As all browsers are in the same boat on this matter, the best (and correct IMHO) solution is for the sites to fix their content.
If we WONTFIX every "non-fatal edge case", Mozilla is going to end up being a royal pain to use. (It arguably already is.) And all RFE's are non-fatal: that's why they're marked "enhancement", and not, say, "critical". I'm curious what the "bigger problems" are. I can't think of any, besides the obvious "it's another special case to deal with bad sites", but I think the added complexity is relatively minor. (Pseudocode for my first suggestion: when launching a helper app for a document, if this document is the only thing in this window [nothing else has been displayed in this window yet] and the target address was a link [not typed into the address bar], then close the window.) Doing nothing and waiting for all web designers to fix their sites may be "correct", but Mozilla has no control over what sites do, and it does have control over what Mozilla does. (That's why there's a Quirks mode -- which is there just to deal with bad sites. Heck, there's even stuff like image-blocking which purposely mis-renders the site to make life easier on users.) (This is my last comment. If you refuse to believe this is a fixable problem, well, what can I do? Cheers...)
Adam, what problems would closing the window cause exactly? All we'd have to do is not parent the various modal helper app dialogs to it (which we should not be doing anyway, imo).... The actual closing is non-trivial (that is, deciding whether we need to close), but I feel that this would be very much worth doing.
I'll CC a few people to see if they have ideas here. The actual closing is what I was worried about. Would you close windows for just "_blank" targets or named targets too? What is the result of closing named targets when the page may expect them to stay there? What about targetted links that point to *existing* named windows? What about js which calls window.open() instead of targetted links? How would you tell the difference between someone clicking on a targetted link and someone right-clicking on a link and choosing "Open in new window", or "Open in new tab"? Or opening a new window and clicking on a bookmark to a pdf file? Or someone dragging a pdf file icon over a new Mozilla? Even if you solved all these problems (a lot of work), I just KNOW that as soon as this was checked in someone else would raise a bug complaining that opening immediately closing windows looked silly. Therefore I don't believe closing the window is acceptable. The only other way I can think of doing it might to "sniff" the content type when a link is clicked on to determine if a new window is required to render it but that means hanging around for it to arrive before the new window can be opened. On slow connections Mozilla will look unresponsive while waiting for this to happen. So again, there would be a perceived impact on performance for what is an edge case and a minor nuisance. If I thought there were a simple way to do this I would reopen this.
You need to log in before you can comment on or make changes to this bug.