利用IE"错觉"实现document.execCommand("SaveAs","","") 默认保存为GB2312 格式
2010-04-13 11:18
447 查看
实现方法大致如下:
注:黄色标识部分为核心实现代码,千万不要把那行代码移除try的包围圈。其他代码我想大家都懂。
var saveWin = null;
saveWin = window.open("","","width=1,height=1,top=1,left=1");
saveWin.document.write("内容");
try {
saveWin.document.charset = "GB2312";
} catch (err) { }
saveWin.document.execCommand("SaveAs","","内容")
saveWin.close();
注:黄色标识部分为核心实现代码,千万不要把那行代码移除try的包围圈。其他代码我想大家都懂。
var saveWin = null;
saveWin = window.open("","","width=1,height=1,top=1,left=1");
saveWin.document.write("内容");
try {
saveWin.document.charset = "GB2312";
} catch (err) { }
saveWin.document.execCommand("SaveAs","","内容")
saveWin.close();
相关文章推荐
- window.document.execCommand("SaveAs",false,id+".xls"); 在IE7下的问题
- IE图片缓存document.execCommand("BackgroundImageCache",false,true)
- JS中用execCommand("SaveAs")保存页面兼容性问题解决方案
- JS 操作IE游览器常用函数:window.external,history,document.execCommand,window.location,WebBrowser.ExecWB
- JS 操作IE游览器常用函数:window.external,history,document.execCommand
- .document.execCommand("BackgroundImageCache",false,true)解决ie6下的背景图片缓存问题
- JS 操作IE游览器常用函数:window.external,history,document.execCommand
- html{filter:expression(document.execCommand("BackgroundImageCache",false,true)
- document.execCommand("BackgroundImageCache", false, true)
- JS document.execCommand实现复制功能(带你出坑)
- document.execCommand() 命令详解 只支持IE
- 利用ffmpeg0.5 和libjpeg实现抽取视频帧并将其保存为jpeg文件格式程序
- document.execCommand("BackgroundImageCache",false,true)
- 利用ffmpeg0.5 和libjpeg实现抽取视频帧并将其保存为jpeg文件格式程序
- filter:expression(document.execCommand("BackgroundImageCache",false,true) 转
- IE6下背景图片不缓存问题或者document.execCommand("BackgroundImageCache",false,true)
- IE6下背景图片不缓存问题或者document.execCommand("BackgroundImageCache",false,true)
- document.execCommand("BackgroundImageCache",false)
- document.execCommand("BackgroundImageCache",false,true)解决ie6下的背景图片缓存问题
- ie下面用iframe实现图片上传,返回json格式时提示打开或保存。