[thelist] Downloading .jpg & .pdf files

Sam-I-Am sam at sam-i-am.com
Thu May 31 16:25:02 CDT 2001


> 
> With an NCSA-compatible server like Apache, you simply put a files
> in a special download-only directory, and stick an .htaccess file in
> that directory for each file type:
>     AddType application/octet-stream jpg
>     AddType application/octet-stream pdf
> 

it might have been this that led me to create a little cgi that fetches
the url provided and reponds with the data prefixed with a content-type
text/plain.

Coupled with a bookmarklet this is a handy way to view the source of
html,js,css,or pretty much any file. (inside the browser, and not in
notepad/your source viewer). This way it also becomes a part of your
browser history, is bookmarkable etc..

Works great in netscape.. But IE (pc) turns out to have a cunning
feature which second-guesses the mime-type the server provides. e.g
text/plain is regarded as a "ambiguous" mime-type and so it scans the
data and handles it as it sees appropriate (invisibly downloading .js
files, looping on downloading css files (does anyone else get that?).
parsing and rendering html files etc..)

what a pain in the arse. 

Sam




More information about the thelist mailing list