Downloading Python files

Robin Munn rmunn at pobox.com
Tue Jul 29 13:06:51 EDT 2003


Terry Reedy <tjreedy at udel.edu> wrote:
> 
> "Luke StClair" <luke at stclair.homelinux.net> wrote in message
> news:slrnbi2j1n.ra.luke at stclair.homelinux.net...
>> Only marginally belonging in this newsgroup... but oh well.
>>
>> I've just started writing in python, and I want to make the files
>> available on the web.  So I did the standard <a
>> href="mypath/myfile.py"> and not surprisingly, it displays like a
>> webpage, but just the code.
> 
> What browser on what system?  As I remember, with IE6/Win98 with
> python installed, even left clicking brings up 'Downloading... open or
> save' box.  And there is always right click 'Download as..' option.

That's because Microsoft is a standard unto themsleves. IE will ignore
the Content-Type header being sent by the server; instead, it will look
at the user's file type settings for the extension of the file. In this
case, the system you were testing on had no entry for the .py extension,
so downloading was the default option. But get this: if you had *wanted*
to show the code (instead of downloading), the way to do it in a
cross-platform way, compatible with every browser *except IE* would be
to set "Content-Type: text/plain" on the file. But <DWS>Microsoft knows
best, dear</DWS>, so IE would override that and make the user download
the file instead of displaying it.

BTW, for those not familiar with DWS, it means Dripping With Sarcasm.

Sorry for the vitriol against IE and Microsoft, but this has been a
*very* annoying issue for me from time to time.

-- 
Robin Munn <rmunn at pobox.com> | http://www.rmunn.com/ | PGP key 0x6AFB6838
-----------------------------+-----------------------+----------------------
"Remember, when it comes to commercial TV, the program is not the product.
YOU are the product, and the advertiser is the customer." - Mark W. Schumann




More information about the Python-list mailing list