Safari Javascript Issue

dmsacks

Registered
Hi,

I'm working on a complex web application. At one point, when a user clicks on a link, I examine the link and determine based on the extension of the file what to do with it.

If the extension is swf or mpg or other media types, I open a new window and use document.write to create a page that uses <object>/<embed> to show the media.

If the extension is anything else, I do a window.location = URL. If the URL points to a word or excel doc (and I am using firefox), I am prompted if I want to open the file in the appropriate application or save the file to my computer.

IE does the same thing.

Safari however doesn't ask. It acts like nothing happens when I click on the link, except I verified the javascript is in fact running. And, the file gets silently saved to the desktop, no warning.

Has anyone else seen this behavior? Is there a way to get safari to prompt to either open or save?

Thanks
 
you could put a prompt box in there that asks if you want to download the file, if they click no cancel...

There might be a setting in safari to turn the the autosave off, but it is on by default.
 
It's a user-defined behavior, not programmer-defined, so I don't think there's anything you can do.

Safari does not have any file-for-file or type-for-type settings for these things. The user tells it where they want files to be downloaded, and they can optionally have it open "safe" files (which is generally a bad idea; it's a hole waiting to be exploited, and in fact has been exploited once or twice). If the user had that option set, I guess the Word/Excel docs would just automatically open. Otherwise, they wouldn't.

Again, I don't think there's anything web developers can do to control this. I don't think you should try to control this behavior, either, personally. As a user, it always irks me when sites/apps don't respect my preferred settings. I wouldn't be confused when "nothing" happens, because as a Safari user, I'll know what to expect — the download window will pop up and the file will get saved, the same way it does with everything else I download.

Just my 2¢. I should note that I'm not an expert with JavaScript, so it's possible there is some way to override this. But I don't think so.
 
Back
Top