HTA 的; 使用其他浏览器托管?
如果微软使用 IE 作为 HTA 本地主机的方法,那么我可以使用任何其他浏览器吗?
If Microsoft's method for using IE as a local host for HTA's then, can I use any other browser instead?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
你不能。
有一个类似的 Mozilla 项目,名为 XULRunner,但 HTA 仅适用于 Internet Explorer - 这两种技术不兼容。
澄清一下:HTA可能无法在 IE 以外的任何环境中工作。 是的,HTA 是窗口中的浏览器控件,但它也具有正常的应用程序权限(即文件系统访问、注册表、任意代码执行等)。 在浏览器中运行时,这些权限将被拒绝(有充分的理由 - 您不希望任何网页读取您的文件)。
因此,在浏览器中启动 HTA 是可行的,但与本地系统的任何交互都会失败,这否定了整个想法。 在 XULRunner 中启动 HTA 也会失败,因为 XULRunner 使用完全不同的 API。
唯一可能起作用的场景是:一个不使用任何特定于 HTA 或特定于 XULRunner 的 API 的 Web 应用程序(即,行为类似于普通的浏览器应用程序)。 在这种情况下,您的应用程序可能适用于 HTA、XULRunner 以及任何浏览器。 顺便说一句,这会剥夺使用 HTA 的任何优势,并由于更高的权限而引入严重的安全漏洞; 为此,您最好使用 Google Chrome 或 Mozilla Prism。
(一段时间以来我们一直在尝试寻找跨浏览器的解决方案,但 HTA 绝对不是)
You can't.
There is a similar Mozilla project named XULRunner, but HTA only works in Internet Explorer - the two technologies aren't compatible.
To make this clear: HTA will probably not work in anything that's not IE. Yes, HTA is a browser control in a window, but it also has normal aplication privileges (i.e. filesystem access, registry, arbirary code execution etc.). When running in a browser, these privileges are denied (for good reasons - you don't want just any webpage to read your files).
So, launching the HTA in a browser will work, but any interaction with the local system will fail, which negates the whole idea. Launching a HTA in XULRunner will also fail, because XULRunner uses a completely different API.
The only scenario that could possibly work is this: a webapp which doesn't use any of the HTA-specific or XULRunner-specific API (i.e. behaves like a normal browser app). In such case, your app might work with HTA, XULRunner, as well as in any browser. Incidentally, this would take away any advantage of using HTA and introduce masive security holes because of the higher privileges; you'd be better off with using Google Chrome or Mozilla Prism for that.
(We've been trying to find a cross-browser solution for some time, and HTA is definitely not it)
我正在处理从各种浏览器运行 hta 的相关任务。 我已将我的发现放在这里,供任何其他尝试这样做并发现这个问题的人使用。
您可以使用 IE 使用的相同 mshta 可执行文件从多个浏览器运行 hta。您的 hta 代码中需要完全限定的 URI,而 IE 不需要。
今天(2011-02-01)我尝试使用 Firefox (3.6.13)、Opera 11 和 Safari for Windows 5.0.3 的 hta 。
在 Firefox 中出现一些初期问题之后,我可以从这些浏览器中使用 hta。 (在所有情况下,这些使用与 IE 使用的相同的 mshta 可执行文件。这不是 hta 在其他浏览器中运行,而是运行 hta 的自 > 其他浏览器。这可能适合您的目的。)
hta 在我的计算机上启动了桌面应用程序(就像从 IE 中一样)。
这次体验并不完美。 对于 IE,我在 hta 中设置根相对路径。 对于其他浏览器你不能这样做。 您需要为图像、引用的 hta 和图标等设置完全限定的 URI。
经过一些编辑后,我的 hta 可以在 4 个浏览器(IE 8、FF 3、Opera 11 和 Safari 5 (Windows))上运行。
(快速快照。我从本地计算机上的 Web 服务器运行 hta。(我不打算从远程站点运行它们。)这使我的工作流程可以更顺利地从浏览器转移到桌面。 hta 启动本地应用程序来执行诸如编辑网页(包括 hta 本身)、验证这些页面并启动 IDE 之类的操作,这是一种解放性的体验,我推荐它。 >
注释:
I was tackling the related task of running hta's from various browsers. I've put my findings here for anybody else who is trying to do that and finds this question.
You can run hta's from several browsers, using the same mshta executable that IE uses. You need fully qualified URI's in your hta code, which isn't needed from IE.
Today (2011-02-01) I tried using hta's from Firefox (3.6.13), Opera 11 and Safari for Windows 5.0.3.
After some teething problems in Firefox I got hta's to work from those browsers. (In all cases these use the same mshta executable that IE uses. This is not hta's running in other browsers, but running hta's from other browsers. This might suit your purposes.)
The hta started desktop applications on my machine (as it does from IE).
The experience wasn't perfect. For IE I set root relative paths in the hta. For the other browsers you can't do that. You need to set fully qualified URI's for things like images, referenced hta's and icons.
So after a little editing I have the hta's working from 4 browsers (IE 8, FF 3, Opera 11 and Safari 5 (Windows)).
(Quick snapshot of that. I'm running hta's from a web server on the local machine. (I have no plans to run them from remote sites.) This allows my workflow to go from browser to desktop more smoothly. The hta's fire up local applications that do things like edit web pages (including the hta's themselves), validate those pages and fire up IDE's. Bridging the gap between browser and desktop apps. has been a liberating experience. I recommend it!)
Notes:
IE 并不是托管任何东西,而是 mshta.exe 托管它与 IE 共享的组件。 MSHTA 是一个脚本宿主,就像 CScript 和 WScript 一样。 虽然 IE 也是一个脚本宿主(从最严格的意义上来说),但它的主要目的是成为一个 Web 浏览器。
前面提到的 Mozilla 项目是我发现的最接近的替代方案,它基于浏览器的内部结构。
Windows 上也存在其他脚本宿主。 其中之一是 NS Basic/Desktop 但它基于标准 Windows 控件,而不是浏览器渲染,并且HTML DOM。
It isn't so much that IE hosts anything, but that mshta.exe hosts components it shares with IE. MSHTA is a script host, much as CScript and WScript are. While IE is also a script host (in the strictest sense) its primary purpose is to be a Web browser.
The Mozilla project mentioned previously is the closest alternative I have found that is based on a browser's innards.
Other script hosts exist for windows too. One of these is NS Basic/Desktop but it is based on standard Windows controls, not browser rendering and an HTML DOM.
需要明确的是:真正渲染网页的不是 IE 也不是 MSHTMA。 渲染部分内置于操作系统中。 因此,诸如 Active Desktop(有人还记得 XP 的东西吗?)或 .HTA 或 .CHM 之类的东西无需 IE 即可工作。 这与识别一些 HTML 内容的方式相同。
Just to be clear: It is not IE nor MSHTMA that really renders a webpage. The rendering thing is partly build into the OS. Thus, things like Active Desktop (does anybody remember that XP thing?) or .HTA or .CHM work without IE. It's just the same way to recognise some HTML things.
我相信 Internet Explorer 的 HTA 应用程序托管是有效的,因为它们的 HTA 主机已注册来处理扩展。 如果确实如此,那么理论上可以使用另一台主机
为了完整起见,我应该指出,我在 HTA 应用程序的开发方面没有经验,并且我的回答基于我对 Windows 操作系统的理解
I believe Internet Explorer's hosting of HTA apps works because their HTA host is registered to handle the extension. If this is indeed the case then in theroy another host could be used
For the sake of completeness I should note that I am not expeirienced in the development of HTA applications and am basing my response on my understanding of the Windows OS