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...
Florida web site design



Czech your Page Rank!
Check Page Rank of any web site pages instantly:
This free page rank checking tool is powered by Page Rank Checker service
Surf's Up!
Visit Egosurf.org and massage YOUR web ego!
My Score: 9,001
Doug's Books

Read (and recommend)

  • Men are from Mars, Women are from Venus
  • The Wisdom of Crowds: Why the Many Are Smarter Than the Few and How Collective Wisdom Shapes Business, Economies, Societies and Nations
  • Blink: The Power of Thinking Without Thinking
  • Head First Design Patterns
  • Transact-SQL Programming
  • What's So Amazing About Grace?
  • Just So Stories (Rudyard Kipling collection)

Reading

  • Prayer: Does it Make Any Difference?
  • Data Mining (Practical Machine Learning Tools and Techniques)
<< May, 2009 >>
SMTWTFS
12
3456789
10111213141516
17181920212223
24252627282930
31
Search Blog

Recent Comments
Categories
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 | 1 comment
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

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!!!

5 plus 4 equals
Type in the answer to the question you see above:

Your comment:

Sorry, no HTML allowed!