开发者

How can I use a link to open file automatically instead of showing open save dialog?

I am trying to open a PPT file. I don开发者_C百科't want to show the Save As dialog. I instead just want to open the file immediately on click. How can this be done?


You need to take two things into account:

  1. The HTTP Content-Disposition header -if any- should be set to inline, not attachment. The later will indeed force the client to display a Save As dialogue.

  2. The HTTP Content-Type header should contain a mime type which is recognized by the client as being a PPT file which is usually application/vnd.ms-powerpoint. When using inline and the browser really don't know what to do with it (i.e. there is no application associated with the content type or extension according to the underlying platform/OS), then it will open the Save As regardless.

You can debug the response headers using tools like Firebug. You can modify response headers in server side code and/or webserver configuration. If you tell which language and/or webserver you're using, then we may be able to give more specific solutions.


This is a browser setting. You can try to force a save dialog with Content-disposition, but not vice-versa. I don't think there's much you can except tell your users to choose to "Always open files of this type".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜