470,591 Members | 2,247 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

IE tries to download PDF rather than display it

fb
A page I created includes a piece of javascript, shown at the foot of
this posting, that opens up a new browser and displays a PDF File. The
servlet "previewCompetencyLevel" generates the PDF and sends it with a
content type of "application/pdf".

The code works fine with Firefox.

However, with IE, instead of opening a new browser and displaying the
PDF, it opens up a new browser AND a "File Download" dialog box, which
is not what I want.

Can someone tell me why IE operates differently to FireFox and what I
can do to get the functionality I want with IE?

Thanks,

Frank.

--- code excerpt start ---

<a href="#"
onClick="window.open('/humanresources/previewCompetencyLevel?abilityDegree=3&parentAbili tyId=186&abilityLevelId=306',
'previewWindow', 'resizable=yes'); return false;">View</a>

--- code excerpt end ---

Sep 8 '05 #1
3 3329
fb schrieb:
A page I created includes a piece of javascript, shown at the foot of
this posting, that opens up a new browser and displays a PDF File. The
servlet "previewCompetencyLevel" generates the PDF and sends it with a
content type of "application/pdf".

The code works fine with Firefox.

However, with IE, instead of opening a new browser and displaying the
PDF, it opens up a new browser AND a "File Download" dialog box, which
is not what I want.

Can someone tell me why IE operates differently to FireFox and what I
can do to get the functionality I want with IE?

Thanks,

Frank.

--- code excerpt start ---

<a href="#"
onClick="window.open('/humanresources/previewCompetencyLevel?abilityDegree=3&parentAbili tyId=186&abilityLevelId=306',
'previewWindow', 'resizable=yes'); return false;">View</a>

--- code excerpt end ---


I assume that isn't a problem in JS but in serverside implementation of the
called script. A serverside-script can "force" the browser to offer the download
instead of showing the file in the browser by sending a
content-disposition-header, in PHP this would look like this:

header("Content-Disposition: attachment; filename=\"FILENAME\"");

But how does the browser reacts when calling the link directly, without JS-Popup?

greetz,

martin
Sep 8 '05 #2
fb said the following on 9/8/2005 9:34 AM:
A page I created includes a piece of javascript, shown at the foot of
this posting, that opens up a new browser and displays a PDF File. The
servlet "previewCompetencyLevel" generates the PDF and sends it with a
content type of "application/pdf".

The code works fine with Firefox.
It works fine with Firefox for the way you have Firefox setup.
However, with IE, instead of opening a new browser and displaying the
PDF, it opens up a new browser AND a "File Download" dialog box, which
is not what I want.
What about what the user wants? I have my IE explicitly set *not* to
open .pdf files but to download them instead. When I do choose to open
them, they do not open in an IE (nor Firefox) window but rather they
open in Adobe, which is the way *I* want it.
Can someone tell me why IE operates differently to FireFox and what I
can do to get the functionality I want with IE?


IE operates differently from Firefox because they are two different
browsers written by two different sets of people.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Sep 8 '05 #3
mjj
It's pretty dopey, but al the examples for this are as you have - ie.
header("Content-Disposition: attachment; filename=\"FILENAME\"");
This forces the pop up box to ask you if you want to save or open etc.

....
But to make it work just change it to :
header("Content-Disposition: inline; filename=\"FILENAME\"");

Mark

Randy Webb wrote:
fb said the following on 9/8/2005 9:34 AM:
A page I created includes a piece of javascript, shown at the foot of
this posting, that opens up a new browser and displays a PDF File. The
servlet "previewCompetencyLevel" generates the PDF and sends it with a
content type of "application/pdf".

The code works fine with Firefox.


It works fine with Firefox for the way you have Firefox setup.
However, with IE, instead of opening a new browser and displaying the
PDF, it opens up a new browser AND a "File Download" dialog box, which
is not what I want.


What about what the user wants? I have my IE explicitly set *not* to
open .pdf files but to download them instead. When I do choose to open
them, they do not open in an IE (nor Firefox) window but rather they
open in Adobe, which is the way *I* want it.
Can someone tell me why IE operates differently to FireFox and what I
can do to get the functionality I want with IE?


IE operates differently from Firefox because they are two different
browsers written by two different sets of people.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly


Sep 26 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael Foord | last post: by
7 posts views Thread by Brian Paul | last post: by
7 posts views Thread by tma | last post: by
4 posts views Thread by tma | last post: by
3 posts views Thread by Alex K | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.