[thelist] CD-ROM question

Shawn K. Quinn skquinn at speakeasy.net
Mon Nov 21 23:20:54 CST 2005


On Mon, 2005-11-21 at 14:29 -0800, Kirk Kristlibas wrote:
> I am building an image library which runs through a web browser from a
> CD-ROM (yes, I know - not my idea..). I have built the interface and
> I'm thinking of an easy way for people to click on an image and
> download it to their desktop. The images are jpegs, so pointing to it
> through an anchor tag opens it in new window instead of forcing the
> dowload.

You shouldn't expect it to force *anything*. The image is already
downloaded; it's just a question of what the browser does with it.

> In PHP I used to use the header() function, set the content-type to
> "application/octet-stream" and open the file in the page - 

You mean, violating the HTTP specification and *lying* to the browser
about what it is really being served? This type of approach *will* cause
problems for users sooner or later. Let's say I want to load the image
into a separate image viewer program. This potentially becomes much more
difficult to do directly from the browser if the image is all of a
sudden sent as "application/octet-stream". Also keep in mind caching
proxies, which may have to cache two copies of the same data, or even
worse (depending on how you have this set up), not cache it at all
resulting in a download from your server every time the image is
requested.

> this would force the browser to download the jpeg - but obviously from
> a CD I can't use server-side technology.

Obviously not.

> Does anyone know of a way javascript could do a similar thing? perhaps
> document.open() or similar?

I don't know much Javascript but I don't think this will solve your
problem.

How would I solve this problem? Actually, it's already been solved; at
least Firefox has "save image as..." in the right click menu.

-- 
Shawn K. Quinn <skquinn at speakeasy.net>




More information about the thelist mailing list