Forum Moderators: open

Message Too Old, No Replies

Cannot open PDFs in new window

Cannot open PDFs in new window

         

cmsgeek

5:59 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



I recently came across an issue where I get an error from IE when either navigating to a .pdf document or opening a new window with the .pdf document using the getURL() method (this also occurs with other types of non-html documents). The function works fine when browsing in Firefox or other browsers. To further confuse things it seems the problem occurs only with a particular server that runs IIS.

initially when trying to open the document I get a prompt asking if I want to download or save because the file looks "suspicious" and then when I click on open or save I get an error stating that IE was unable to open the file.

The IS department that manages the server claims that no error logs are generated when this happens.

I have attempted to use javascript workarounds and the only method that has worked is redirecting to the document using document.location. I get the same error if using the window.open.

rocknbil

7:04 pm on Jan 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you use the methods specified in this thread [webmasterworld.com]?

The second parameter is the target.

getURL('url','_blank');

cmsgeek

7:29 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



Thank you for your quick reply.

I did. I setup a simple flash that opens the very same .pdf document using the same getURL('foo.pdf','_blank') method on another server and it works fine no matter the browser.

cmsgeek

8:41 pm on Jan 10, 2005 (gmt 0)

10+ Year Member



OK! found a solution. It appears that if the server is set to expire pages these problems will occur (IIS only?). We were able to overcome by setting the server to expire pages after 1 day.

Hope this helps anyone else who runs into this same problem.

whoisgregg

9:36 am on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld cmsgeek!

Thanks also for following up with the solution you discovered. :)

Sari

12:23 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



Hi cmsgeek--I am running into a similar issue. I am a newbie when it comes to server settings. Can you outline how you set the server to expire the pages? Thanks!

cmsgeek

3:01 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



You will need to get to the properties of your site in the IIS snap-in. Once the properties box appears select the "HTTP Headers" tab. On that page you should be able to enable content expiration by checking the box next to it and then select "Expire after" where you can set the duration.

Note that in my particular case "Expire immediately" was the setting my server was set to when I was experiencing the problem. I didn't try deselecting content expiration altogether which may also work.

Sari

3:12 pm on Jan 11, 2005 (gmt 0)

10+ Year Member



Thank you! I'll give that a try :)

rocknbil

7:37 pm on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doesn't the meta tag work if you want to expire pages?

<META HTTP-EQUIV="Expires" CONTENT="Sat, 01 Dec 1993 23:59:59 GMT">

The restrictive factor being it has to be the correct date format, as long as it's in the past it should expire.

whoisgregg

8:15 pm on Jan 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can't use a meta tag in a PDF document. For that, you have to go into your server config.

rocknbil

3:19 am on Jan 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<Forehead is now crimson from smacking> DUH :-)

whoisgregg

4:40 am on Jan 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Don't feel too bad. At least a PDF is a text format -- better than suggesting to paste the meta tag into a gif. :)