最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Does HTML5 work in a .hta file? - Stack Overflow

programmeradmin5浏览0评论

I am trying to understand what the main difference between hta and html files is. I googled it and I found this:

The main problem is that javascript is buggy. For example the javascript: protocol does not even exist. Hta seems to prefer VBscript modeled coding instead of the javascript model, such as <span style="cursor:hand" onclick=go()> instead of <a href="#" onclick=go()>. It's a windows exe so some cross-browser/cross-platform contructs of html are simply not supported or ill-supported. Also window resizing produces different dimensions.

I have some interactive plots (HTML5) generated by JavaScript codes. Are they gonna be functional if I transfer them to hta files?

I am trying to understand what the main difference between hta and html files is. I googled it and I found this:

The main problem is that javascript is buggy. For example the javascript: protocol does not even exist. Hta seems to prefer VBscript modeled coding instead of the javascript model, such as <span style="cursor:hand" onclick=go()> instead of <a href="#" onclick=go()>. It's a windows exe so some cross-browser/cross-platform contructs of html are simply not supported or ill-supported. Also window resizing produces different dimensions.

I have some interactive plots (HTML5) generated by JavaScript codes. Are they gonna be functional if I transfer them to hta files?

Share Improve this question edited Feb 3, 2016 at 15:58 Bergi 667k161 gold badges1k silver badges1.5k bronze badges asked Feb 3, 2016 at 15:37 Hamid KHamid K 1,1651 gold badge22 silver badges45 bronze badges 2
  • 4 en.wikipedia/wiki/HTML_Application – dsgriffin Commented Feb 3, 2016 at 15:39
  • 1 Related: JavaScript version in HTA. – Teemu Commented Feb 3, 2016 at 15:41
Add a ment  | 

2 Answers 2

Reset to default 3

If you don't add any special code, the answer is no.

Usually, HTML5 doesn't work in HTA files because they are run by mshta.exe which acts like IE7 and HTML5 isn't supported in earlier versions of IE than IE9. But if you add <meta http-equiv="x-ua-patible" content="ie=edge" /> in the head of the HTA, the HTA will act like the version of IE installed on the puter, so if the puter has IE9 or later and you add that tag, it will work. The problem with this is that if you upgrade the HTA, the <hta:application/> tag won't have any effect so you will lose all effects like icons, window properties, etc. For this reason, I prefer to not upgrade the HTA and to use workarounds instead of HTML5.

In HTA, to get the code to properly work, you must include the tag <meta http-equiv="x-ua-patible" content="ie=edge" /> or <meta http-equiv="x-ua-patible" content="ie=9">to get the JavaScript and HTML 5 to work pletely. You may add

<HTA:APPLICATION
APPLICATIONNAME="HTA"
ID="HTA"
VERSION="1.0"
MAXIMIZEBUTTON="no"/>

Or some variant of that to get the HTA window to work properly. If you would post the code, Hamid K, that you are referring to, I would check it for you to more thoroughly answer the question.

发布评论

评论列表(0)

  1. 暂无评论