window.open() behaving strangely when opening PDF files

RESOLVED INVALID

Status

()

RESOLVED INVALID
4 years ago
4 years ago

People

(Reporter: cito, Unassigned)

Tracking

35 Branch
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

529 bytes, text/html
Details
(Reporter)

Description

4 years ago
Created attachment 8561419 [details]
test.html

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20150122214805

Steps to reproduce:

Started Firefox 35.0.1 on Windows 7 64 bit.

Loaded the attached test.html file, which opens an arbitrary PDF file (called test.pdf) in a window created with window.open() after clicking a link, in two different manners.

The first link ("onestep") loads the PDF file directly in the window.open() command. The second link ("twostep") first opens an empty window with window.open() and then loads the PDF into that window by setting the location property of the window.


Actual results:

In the first case, an empty browser window opens, but then immediately closes again and the PDF is not displayed embedded in the opened browser window, but in a PDF viewer window.

In the second case, the empty window opens, then the PDF is displayed not in the browser window, but in another window of the PDF viewer, and the empty window stays open.


Expected results:

I would expect that the PDF is displayed embedded in the browser window opened with window.open(), not in a PDF viewer window. This is what happens in the current version of the other browsers MSIE 11, Chrome 40, Opera 27.

Also, I would expect that at least the two different ways of loading the PDF into the browser window would behave the same, i.e. the empty browser window either always closes or always stays open, but I prefer that it's closed in both cases.
(Reporter)

Comment 1

4 years ago
Comment on attachment 8561419 [details]
test.html

<!DOCTYPE html>
<html>
<head>
<script>
var pdf='http://stlab.adobe.com/wiki/images/d/d3/Test.pdf';
function onestep() {
  window.open(pdf, 'test', 'height=400,width=200');
  return false;
}
function twostep() {
  w = window.open('', 'test', 'height=400,width=200');
  w.location = pdf;
  return false;
}
</script>
</head>
<body>
<h1>Test<h1>
<h2><a href="loaded-if-no-javascript.pdf" onclick="return onestep()">onestep</a></h2>
<h2><a href="loaded-if-no-javascript.pdf" onclick="return twostep()">twostep</a></h2>
</body>
</html>
(Reporter)

Comment 2

4 years ago
Comment on attachment 8561419 [details]
test.html

<!DOCTYPE html>
<html>
<head>
<script>
var pdf='http://stlab.adobe.com/wiki/images/d/d3/Test.pdf';
function onestep() {
  window.open(pdf, 'test', 'height=400,width=200');
  return false;
}
function twostep() {
  w = window.open('', 'test', 'height=400,width=200');
  w.location = pdf;
  return false;
}
</script>
</head>
<body>
<h1>Test<h1>
<h2><a href="loaded-if-no-javascript.pdf" onclick="return onestep()">onestep</a></h2>
<h2><a href="loaded-if-no-javascript.pdf" onclick="return twostep()">twostep</a></h2>
</body>
</html>
(Reporter)

Comment 3

4 years ago
Created attachment 8561423 [details]
Test HTML file
Attachment #8561419 - Attachment is obsolete: true
(Reporter)

Comment 4

4 years ago
The last comments have been entered accidentally, please ignore them, unfortunately Bugzilla does not allow me to delete them.
(Reporter)

Comment 5

4 years ago
Just a some background why it's sometimes necessary to load the PDF in 2 steps (1. open empty window, 2. set location) instead of 1 step (open window with location): The reason is that you need to open the window in the click event function because otherwise the popup blocker inhibits it. On the other hand, before opening the PDF you might want to execute something like submitting a form to set certain parameters for the PDF. PDF can then only be opened after that form is submitted, in some callback function, not in the original click event.
(Reporter)

Comment 6

4 years ago
I should have also mentioned that I refer to the case where Firefox has been configured to use an external PDF viewer.
(Reporter)

Comment 7

4 years ago
Closing this, because I messed things up a bit, will reopen a clean ticket.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → INVALID
(Reporter)

Comment 8

4 years ago
This is now bug #1133062.
You need to log in before you can comment on or make changes to this bug.