简体   繁体   English

在浏览器中强制Mime类型(使用Javascript)

[英]Force Mime Type in Browser (with Javascript)

[I imagine that this is impossible due to security concerns, but:] [我认为由于安全问题,这是不可能的,但是:]

Is it possible to force the browser to handle a file with a certain mime type without controlling the server? 是否可以强制浏览器处理具有某种mime类型的文件而无需控制服务器? I'm serving up files from file:// (on the client's machine itself) and I'd like to get text files to open in whatever their associated text editor is. 我正在从file://(在客户端的机器本身上)提供文件,我想在任何相关的文本编辑器中打开文本文件。

Note: Firefox just opens the file for viewing, which is not the desired behavior. 注意:Firefox只是打开文件进行查看,这不是所需的行为。 I've tried changing the file extension even to something unknown, which does not help. 我已经尝试将文件扩展名更改为未知的内容,这没有用。

不,这是不可能的,除了可能使用IE和ActiveX,但我认真建议你不要使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM