LocalStorage as storage alternatives for HTA

I am developing an HTA application, for this I need to store some data on the client side using JavaScript. Like localStorage in HTML5, I'm just looking for the same functionality, if possible. Please let me know if I can find them.

+4
source share
3 answers

In HTA, you can use whatever ActiveX you want. FileSystemObject is the best solution for simple operations with folders and files, although it can only read and write text files. With this ActiveX Control, you can also create and delete folders and files, extract their properties, etc.

FSO and HTAs still work in IE9. However, all development and support was completed in IE7, so all HTML and JavaScript features (and errors) are at that level. To use the features available for IE9, use <meta http-equiv="x-ua-compatible" content="ie=9"> in <head> . This only works with single pages and cannot be used in frameset countries.

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

Key Features in FileSystemObject

Create ActiveX:

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

Write file:

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

Open the file:

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

See also WScript.Shell : http://msdn.microsoft.com/en-us/library/98591fh7%28v=vs.84%29.aspx

+8
source

I'm not sure if it still works with newer versions of IE (> 6), but you can try ActiveSystemObject ActiveX component.

+1
source

In hta, you can write your data in Microsoft Access * .mdb. see this
or you can use google gears to support mysql.

+1
source

Source: https://habr.com/ru/post/1401185/


All Articles