开发者

How to open, modify and save a file with javascript and ActiveX?

开发者 https://www.devze.com 2023-02-05 03:43 出处:网络
I tried different methods to open and show a file on client without to send the file to a server. Opening: I tried to access the file with javascript from a <input type=file>, but the security

I tried different methods to open and show a file on client without to send the file to a server.

Opening: I tried to access the file with javascript from a <input type=file>, but the security restriction seems to not allow that. I tried also <iframe src=file://local.path> with the same problem. Last i tried with new ActiveXObject('Scripting.FileSystemObject');, but I get always an error that automationserver could not create the Object.

For saving I tried t开发者_Go百科o use execCommand('SaveAs',true) from TextRange and DocumentFragment. From DocumentFragment I'm able to save a file but it contains only <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">. From TextRange is no save dialog shown.

What could I do?


From a web site, you cannot do any of this unless you use a signed script

From local file system, IE can use the filesystem object from an HTA


Sorry,

You can not access the local file system through a browser without having the user install a plug-in/activex object.

It may be that you should try another cross-platform delivery method, such as Adobe Air.

0

精彩评论

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

关注公众号