Categories
Contact Doug!
Learn About Doug!
View Doug Boude's online resume
updated 11/18/2009

View Doug Boude's profile on LinkedIn
Link to me!

Follow Doug Boude on Twitter
Follow me!

Be Doug's friend on Facebook
Befriend me!
(I promise not to follow you home)
OO Lexicon
Chat with Doug!
Recent Entries
You may also be interested in...
Web Hosting

<< May, 2013 >>
SMTWTFS
1234
567891011
12131415161718
19202122232425
262728293031
Search Blog

Recent Comments
Re: Disappearing IE Popup Window During Save/Open Dialog (by LZ at 4/20 7:58 AM)
Re: Create Dynamic WHERE Clauses in PHP (by pooja at 3/20 7:29 AM)
Re: Just What IS a 'Service Layer', Anyway? (by EugenK at 3/07 7:56 PM)
Re: Using Google as your CF Mail Server (by 5starwebteam.com at 2/25 1:27 AM)
Re: Why Provide for Service layer objects in CFWheels? (by Steven Benjamin at 1/25 11:43 AM)
Re: What is an 'Advanced' Coldfusion Developer? (by ColdFusion Developer at 12/24 5:14 AM)
Re: Equivalent of SQL "TOP X" in Oracle (by Ashenafi Desalegn at 12/06 5:29 AM)
Re: PHP Export to Excel Snippet (by serene at 12/05 1:44 AM)
Re: Just What Is 'Application Logic', Anyway? (by Arif at 11/13 8:06 AM)
Re: Hosts File Changes Not Acknowledged on Vista 64 (by Aaron at 10/22 2:31 PM)
Re: PHP Export to Excel Snippet (by Jafar Shah at 10/10 4:28 AM)
Re: Viewing Option Text (in IE7) that's Wider than the Select List (by Chenelle S at 10/04 12:53 PM)
Re: PHP Export to Excel Snippet (by Kilo at 9/26 5:20 PM)
Re: Porting Coldfusion Code to Mura (by tariq at 9/03 9:51 AM)
Re: Just What IS a 'Service Layer', Anyway? (by James at 8/27 4:06 PM)
Re: Calculating Business Hours (by helen at 8/14 2:54 AM)
Re: What IS 'Business Logic', Anyway? (by dougboude at 8/06 11:30 AM)
Re: What IS 'Business Logic', Anyway? (by Adrianne at 8/06 10:29 AM)
Re: Family Law: The Weapon of Choice for Woman Scorned (by dougboude at 8/04 4:39 PM)
Re: Family Law: The Weapon of Choice for Woman Scorned (by Lola LB at 8/04 7:43 AM)
Archives
Photo Albums
Funnies (5)
Family (3)
RSS

Powered by
BlogCFM v1.11

26 June 2009
Disappearing IE Popup Window During Save/Open Dialog

okay, I had a major wrestling match today when attempting to allow my users to automatically save or download a dynamically generated Excel spreadsheet, so thought I'd share the details in case it helps someone else save some hair pulling.

The Scenario

You have a page with a link on it. Clicking this link produces a popup window, the code behind it querying a database, writing an excel file to disk, setting the content headers, and then prompting the user to open or save the file.

The Symptoms

In IE (i'm using version 8), your user clicks the link to "Export Data", popup window appears, and then promptly closes without so much as a "how do you do". (in other browsers, such as Chrome and Firefox, everything behaves just like it should; user clicks link, popup appears, user is immediately prompted to either open or save the file)

The Solution

After trying all MANNER of values for headers, it turns out the magic combo for making it work (in my case, anyway) had two parts to it:

1. DO cache the content. This is accomplished by making sure you DO NOT have a "Pragma: no-cache" header, and including a header like this: Expires: Thu, 01 Dec 2010 16:00:00 GMT (or any other future date...perhaps you could automatically calculate it to be one minute in the future or something). Seems that IE, if you have said NOT to cache content, can't find the file by the time it gets to the dialog because it already uncached it. Strange behavior, but true.

2. Check your browser settings to ensure that you have "Automatic prompting for file downloads" ENABLED. By default it is DISABLED. Here's a screenshot of that setting to help you locate it:

changing automatic download settings in IE 8

After I did those two things, my download link behaved as it did in the other browsers I tested.

Just for clarification, here are the headers and values I ended up with (this is PHP code, so just deal with it):

header ("Content-type: application/vnd.ms-excel");
header ("Content-Disposition: attachment; filename=".$tmpfilename);
header ("Expires: Thu, 01 Dec 2010 16:00:00 GMT");

Okay, that's it. Hope it helps someone else save some time.

Doug out

 

 




Posted by dougboude at 5:23 PM | PRINT THIS POST! |Link | 5 comments
Subscription Options

You are not logged in, so your subscription status for this entry is unknown. You can login or register here.

Re: Disappearing IE Popup Window During Save/Open Dialog
If you are downloading via SSL, you won't need the nocaching and expires rules. I've had issues where IE gets confused and won't download anything as a result. The best way to do this is check the CGI server port value. If it's "80" (default port), then do the no cache rules.
Posted by James Moberg on June 26, 2009 at 7:17 PM

Re: Disappearing IE Popup Window During Save/Open Dialog
Thank you very much. After searching many websites you came up with the solution to my problem.
Posted by Jonathan Minkus on April 19, 2010 at 6:48 AM

Re: Disappearing IE Popup Window During Save/Open Dialog
nice solution. thank you so much
Posted by Shameer on November 11, 2010 at 6:35 AM

Re: Disappearing IE Popup Window During Save/Open Dialog
Thanks a lot, it really helped.
Posted by Vivekanand on January 6, 2012 at 12:51 AM

Re: Disappearing IE Popup Window During Save/Open Dialog
Is there a workaround that goes without changing the browser default settings?
Posted by LZ on April 20, 2013 at 7:58 AM

Name:   Required
Email:   Required your email address will not be publicly displayed.

Want to receive notifications when new comments are added? Login/Register for an account.

Time to take the Turing Test!!!

Zero plus Fifteen equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!