I have written an HTML Application (hta file) and am wondering if there is a way to embed an icon file into the hta file itself.
I have seen html emails that include embedded graphic files, is there any way to do this with html applications and icons?
HTA files have an HTA:APPLICATION tag that allows you to specify an icon, but I want to have only a single file for download. I don't want to have an external icon file. Is this possible?
More info on hta files here: HTA files.
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 icon and hta into a single file.
In my test case Internet explorer skipped over the icon data and display the HTML correctly.
The path of the icon is then set to that of the .hta file itself using javascript and the icon is loaded.
I have tested this on Windows XP SP3, Internet explorer 8.