HTA 的; 使用其他浏览器托管?

发布于 2024-07-24 12:28:50 字数 48 浏览 4 评论 0原文

如果微软使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

千仐 2024-07-31 12:28:50

你不能。

有一个类似的 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)

对你而言 2024-07-31 12:28:50

我正在处理从各种浏览器运行 hta 的相关任务。 我已将我的发现放在这里,供任何其他尝试这样做并发现这个问题的人使用。

您可以使用 IE 使用的相同 mshta 可执行文件从多个浏览器运行 hta。您的 hta 代码中需要完全限定的 URI,而 IE 不需要。

今天(2011-02-01)我尝试使用 Firefox (3.6.13)Opera 11Safari 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 之类的操作,这是一种解放性的体验,我推荐它。 >

注释:

  1. Firefox 开发团队有关于启用 hta 的注释,这鼓励我在最初的失败后继续前进。
  2. 为了在 Firefox 配置中实现此目的,我将 HTML 应用程序设置为在 mshta.exe 下运行(在组合框中称为 Microsoft HTML 应用程序主机)。 最初这不起作用。 我选择了“其他”,手动选择了相同的应用程序。 这很有效,尽管我有两个看起来相同的条目! 您的计算机上需要 mshta.exe 才能在任何浏览器上运行。 我假设安装 mshta 的正常方法是使用 IE。 (mshta 本质上是 IE 的修改版本,可能不是当前版本!
  3. Firefox 开发人员将此标记为将 IE 从企业版中驱逐出去的战略努力。 它们的实现(以及 Opera 的实现)强制您使用完全限定的 URI,但除此之外,hta 仍按预期工作。
  4. Firefox 似乎缓存 hta 的旧版本,并且不下载新版本,尽管它似乎下载了一些东西! 您可能需要在开发过程中清除缓存。
  5. 我第一次尝试使用 Chrome 进行此操作并不成功。 进一步调查表明,根据文件扩展名,Chrome 没有用于调用其他进程的本机界面

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:

  1. The Firefox development team have notes about enabling hta's which encouraged me to continue after initial failure.
  2. To achieve this in Firefox configuration I set HTML applications to run under mshta.exe (called Microsoft HTML Application Host, in the combo box). Initially that didn't work. I selected "other" picked the same application by hand. That worked, though I have two identical looking entries! You need mshta.exe on your machine to run for any browser. I assume the normal way to install mshta is with IE. (mshta is essentially a modified version of IE, possibly not the current version!)
  3. The Firefox developers have marked this as a strategic effort to dislodge IE from the Enterprise. Their implementation (and Opera's) force you to use fully qualified URI's but apart from that the hta's work as expected.
  4. Firefox seems to cache old versions of the hta's, and doesn't download new ones, though it appears to download something! You might need to clear the cache during development.
  5. My first attempt to do it with Chrome was not successful. Further investigation suggests Chrome doesn't have a native interface for invoking other processes, based on their file extension.
江南月 2024-07-31 12:28:50

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.

羁拥 2024-07-31 12:28:50

需要明确的是:真正渲染网页的不是 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.

勿忘初心 2024-07-31 12:28:50

我相信 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文