Can I embed an icon to a .hta file?

I’ve found an hack to set the icon. Prepare an icon file icon.ico and an hta file source.hta with the following contents: <HTML> <HEAD> <SCRIPT> path = document.URL; document.write( ‘<HTA:APPLICATION ID=”oHTA” APPLICATIONNAME=”myApp” ICON=”‘+path+'”>’); </SCRIPT> </HEAD> <BODY SCROLL=”no”> Hello, World! </BODY> </HTML> Open a command prompt and type: copy /b icon.ico+source.hta iconapp.hta That will concatenate the … Read more

How can I open a link in the default web browser from an HTA?

Create a shell and attempt to run a URL. This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox: <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> <html lang=”en”> <head> <title>HTA Test</title> <hta:application applicationname=”HTA Test” scroll=”yes” singleinstance=”yes”> <script type=”text/javascript”> function openURL() { var shell = … Read more

Writing data to a local text file with javascript

Our HTML: <div id=”addnew”> <input type=”text” id=”id”> <input type=”text” id=”content”> <input type=”button” value=”Add” id=”submit”> </div> <div id=”check”> <input type=”text” id=”input”> <input type=”button” value=”Search” id=”search”> </div> JS (writing to the txt file): function writeToFile(d1, d2){ var fso = new ActiveXObject(“Scripting.FileSystemObject”); var fh = fso.OpenTextFile(“data.txt”, 8, false, 0); fh.WriteLine(d1 + ‘,’ + d2); fh.Close(); } var submit … Read more

How to get IE9 standards support for dialogs opened by HTA?

A quick Google of the keywords in this question gave me this page on Microsoft MSDN site: http://msdn.microsoft.com/en-us/subscriptions/ms536496(v=vs.85).aspx The answer to your question is on tha page. The answer is to add an x-ua-compatible meta tag to your HTML’s <head> section. To quote: By default, HTAs display webpages in Compatibility View, which displays standards-mode content … Read more

JavaScript version in HTA

The used JavaScript (or JScript) version depends on three things: installed Interner Explorer version, used document type declaration (DTD) and x-ua-compatible meta tag. Though HTAs are run by mshta.exe, IE provides the JavaScript and rendering engines to applications, hence everything said later about JS versions, stands for box-models, positioning, CSS etc, and available APIs and … Read more