在浏览器中强制使用Mime类型(使用Javascript) [英] Force Mime Type in Browser (with Javascript)

查看:146
本文介绍了在浏览器中强制使用Mime类型(使用Javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[我想出于安全考虑,这是不可能的,但是:]

[I imagine that this is impossible due to security concerns, but:]

是否可以强制浏览器在不控制服务器的情况下处理具有特定MIME类型的文件??我是通过file://(在客户端计算机上)提供文件的,我想使文本文件可以在与之相关的文本编辑器中打开.

Is it possible to force the browser to handle a file with a certain mime type without controlling the server? 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.

注意:Firefox仅打开文件进行查看,这不是所需的行为.我尝试将文件扩展名更改为未知的文件,但这无济于事.

Note: Firefox just opens the file for viewing, which is not the desired behavior. I've tried changing the file extension even to something unknown, which does not help.

推荐答案

不,这是不可能的,除非使用IE和ActiveX,但我强烈建议您不要使用它.

Nope, this is impossible, except maybe with IE and an ActiveX, but I seriously suggest you not to use it.

这篇关于在浏览器中强制使用Mime类型(使用Javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆