类似于HTA的存储替代品的localStorage [英] localStorage like storage alternatives for HTA

查看:137
本文介绍了类似于HTA的存储替代品的localStorage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发HTA应用程序,为此,我需要使用JavaScript在客户端存储一些数据.像HTML5中的localStorage一样,如果可能的话,我只是在寻找相同的功能.如果可以找到我,请告诉我.

I am developing a HTA application, for that I need to store some data at client side using JavaScript. Like localStorage in HTML5, I am just looking for same functionality if possible. Please let me know if I can found any.

推荐答案

在HTA中,您可以自由使用所需的任何ActiveX. FileSystemObject是简单文件夹和文件操作的最佳解决方案,尽管它只能读取和写入文本文件.使用此ActiveX控件,您还可以创建和删除文件夹和文件,检索其属性等.

In HTA you are free to use any ActiveX you want. FileSystemObject is the best solution for simple folder and file actions, though it can read and write text files only. With this ActiveX Control you can also create and delete folders and files, retrieve their properties etc.

FSO和HTA仍在IE9中工作.但是,所有开发和支持都在IE7上结束,因此所有HTML和JavaScript功能(和错误)也都处于该级别.要使用IE9可用的功能,请使用<head>中的<meta http-equiv="x-ua-compatible" content="ie=9">.这仅适用于单页,不能在frameset -pages中使用.

FSO and HTAs are still working in IE9. However, all development and support was ended at IE7, so all HTML and JavaScript capabilites (and bugs) are on that level too. To utilize features available to IE9, use <meta http-equiv="x-ua-compatible" content="ie=9"> in <head>. This works with single pages only, and can't be used within frameset-pages.

FileSystemObject: http://msdn .microsoft.com/en-us/library/6kxy1a51%28v = vs.84%29.aspx 超文本应用程序: http://msdn. microsoft.com/en-us/library/ms536471%28v=vs.85%29.aspx

FileSystemObject: http://msdn.microsoft.com/en-us/library/6kxy1a51%28v=vs.84%29.aspx HyperText-Applications: http://msdn.microsoft.com/en-us/library/ms536471%28v=vs.85%29.aspx

FileSystemObject中的基本功能

创建ActiveX:

fso=new ActiveXObject('Scripting.FileSystemObject');

写一个文件:

var oStream=fso.OpenTextFile('SAVE_PATH',2,true);
oStream.WriteLine('YOUR_DATA'); // Usually looped for several lines
oStream.Close();

打开文件:

var iStream=fso.OpenTextFile('OPEN_PATH',1,false);
data=iStream.ReadLine(); // Usually looped for several lines
iStream.Close();

另请参见WScript.Shell: http ://msdn.microsoft.com/en-us/library/98591fh7%28v=vs.84%29.aspx

这篇关于类似于HTA的存储替代品的localStorage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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