Html hta - Firefox、Chrome 中的等效项 - 这是旧技术吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10619990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
hta - Equivalents in Firefox, Chrome - Is this old technology?
提问by Rewind
I want to convert a webpage html5/js page to a desktop application. Something they can use on their desktop without a live internet connection. (I do not want to recode my html5 or js.)
我想将网页 html5/js 页面转换为桌面应用程序。他们可以在没有实时互联网连接的情况下在桌面上使用的东西。(我不想重新编码我的 html5 或 js。)
If the end user has Internet Explorer installed, I can easily port this to an hta file. However, what if they are using Vista or above and have uninstalled Internet Explorer (as you are permitted to do)? What if their main browser is Firefox or Chrome?
如果最终用户安装了 Internet Explorer,我可以轻松地将其移植到 hta 文件中。但是,如果他们使用的是 Vista 或更高版本并且已经卸载了 Internet Explorer(您可以这样做)怎么办?如果他们的主浏览器是 Firefox 或 Chrome 怎么办?
I was searching around for Firefox, and it seemed Prism was an alternative to hta files, but if you go to Mozilla's Prism page it says it is a technology that is no longer being pursued.
我在四处寻找 Firefox,似乎 Prism 是 hta 文件的替代品,但是如果您访问 Mozilla 的 Prism 页面,它会说它是一种不再被追求的技术。
So I have several questions:
所以我有几个问题:
- Is the hta file still a modern technology for Internet Explorer which is still going to work in IE9, IE10?
- Will hta files, with no security issues or local access issues, automatically fire up Firefox/Chrome if IE is not installed on Windows (or other operating systems)?
- Can I add some of html5's local storage stuff to my hta file and will it still work on IE, FF and Chrome?
- If these things will not work on FF or Chrome, do they have any alternatives which are modern and are not deprecated techs?
- hta 文件仍然是 Internet Explorer 的现代技术,它仍然可以在 IE9、IE10 中使用吗?
- 如果 IE 没有安装在 Windows(或其他操作系统)上,那么没有安全问题或本地访问问题的 hta 文件会自动启动 Firefox/Chrome 吗?
- 我可以将一些 html5 的本地存储内容添加到我的 hta 文件中,它仍然可以在 IE、FF 和 Chrome 上运行吗?
- 如果这些东西在 FF 或 Chrome 上不起作用,他们是否有任何现代且未弃用的技术的替代品?
采纳答案by Maher Fattouh
I'd say that .hta applications are way out of date since they don't support modern design standards. you can still use them or use another HTML Compilers like the one by David Esperalta, it's good enough for very simple apps, but they all depend on IE and we all know how limited and slow it is.
我想说 .hta 应用程序已经过时了,因为它们不支持现代设计标准。你仍然可以使用它们或使用另一个 HTML 编译器,比如 David Esperalta 的那个,它对于非常简单的应用程序来说已经足够好了,但它们都依赖于 IE,我们都知道它是多么有限和缓慢。
Modern Alternatives:
现代替代品:
both mentioned options are based on Chromium(same as Chrome), Node.jsand V8. they support HTML5, CSS3and latest JavaScript engine including latest ECMAScriptfeatures and beyond!
上述两个选项均基于Chromium(与 Chrome 相同)、Node.js和 V8。它们支持HTML5、CSS3和最新的 JavaScript 引擎,包括最新的ECMAScript功能等!
and since they use node.jsyou can use any of its built-in libraries (like FileSystem)or any of npm packagesright in your DOM!
并且由于它们使用node.js,您可以直接在您的 DOM 中使用它的任何内置库(如 FileSystem)或任何 npm 包!
The npm registry hosts over a quarter million packages of reusable code — the largest code registry in the world.
npm 注册中心托管着超过 25 万个可重用代码包——世界上最大的代码注册中心。
both options are FREE and open sourced but electron supports ffmpeg codecs without downloading or building them.
这两个选项都是免费和开源的,但电子支持 ffmpeg 编解码器,无需下载或构建它们。
- both options now support ffmpeg out of the bag.
- 这两个选项现在都支持 ffmpeg。
your app will be 100% standalone and you can build same app for Windows, macOS and Linux.
您的应用程序将是 100% 独立的,您可以为 Windows、macOS 和 Linux 构建相同的应用程序。
electron can also provide simple solutions to automatically compile and use CoffeeScript, Babel, LESS, SASSand more.
Electron 还可以提供简单的解决方案来自动编译和使用CoffeeScript、Babel、LESS、SASS等。
Downsides:
缺点:
? You'll always have to ship the whole thing with you application since there's no run-time solution and you'll end up with a relatively big package.
? 由于没有运行时解决方案,您将始终必须将整个内容与应用程序一起交付,并且最终会得到一个相对较大的包。
? startup time is less than ideal for some applications
? 对于某些应用程序来说,启动时间不太理想
? although there is some methods to make it harder but your code will be available for anyone with an idea of what they are doing.
? 尽管有一些方法可以使它变得更难,但是您的代码将可供任何了解他们正在做什么的人使用。
回答by Teemu
Actually HTAs are not run by Internet Explorer. They are run by mshta.exe, which is installed in Windows/System32 (Windows7). However, HTAs use IE's rendering engine, and can't be run without IE. Also they are available for Windows users only.
实际上 HTA 不是由 Internet Explorer 运行的。它们由安装在 Windows/System32 (Windows7) 中的 mshta.exe 运行。但是,HTA 使用 IE 的渲染引擎,没有 IE 无法运行。此外,它们仅适用于 Windows 用户。
HTML5 support can be added by using <meta http-equiv="x-ua-compatible" content="ie=9">
. By my own experience also <!DOCTYPE html>
is needed.
可以使用 .html 添加 HTML5 支持<meta http-equiv="x-ua-compatible" content="ie=9">
。以我自己的经验来说也是<!DOCTYPE html>
需要的。
More info in MSDN: Introduction to HTAs
MSDN 中的更多信息:HTA 简介
In SO: HTA's; use other browser to host?
在 SO 中:HTA;使用其他浏览器托管?
回答by Marcus Pope
1.Is the hta file still a modern technology for Internet Explorer which is still going to work in IE9, IE10?
1.hta 文件是否仍然是 Internet Explorer 的现代技术,并且仍然可以在 IE9、IE10 中使用?
Most likely yes. The underlying technology is based on embedding the IE browser control as an activex object. Even if mshta was no longer distributed with windows a replica could still be created using c# and the browser control.
很可能是的。底层技术基于将 IE 浏览器控件嵌入为 activex 对象。即使 mshta 不再随 Windows 分发,仍然可以使用 c# 和浏览器控件创建副本。
2.Will hta files, with no security issues or local access issues, automatically fire up Firefox/Chrome if IE is not installed on Windows (or other operating systems)?
2.没有安全问题或本地访问问题的hta文件,如果没有在Windows(或其他操作系统)上安装IE,会自动启动Firefox/Chrome吗?
Nope, although the .hta extension can be associated with those browsers, the mshta directives are not supported by either - the result is that the browser prompts you to save the document as an external file like an exe or zip file would.
不,虽然 .hta 扩展名可以与这些浏览器相关联,但 mshta 指令不受任何一种支持 - 结果是浏览器提示您将文档另存为外部文件,如 exe 或 zip 文件。
3.Can I add some of html5's local storage stuff to my hta file and will it still work on IE, FF and Chrome?
3.我可以将一些 html5 的本地存储内容添加到我的 hta 文件中,它仍然可以在 IE、FF 和 Chrome 上运行吗?
Yes you can add html5 support, but again it will only work on IE.
是的,您可以添加 html5 支持,但它再次仅适用于 IE。
4.If these things will not work on FF or Chrome, do they have any alternatives which are modern and are not deprecated techs?
4.如果这些东西在 FF 或 Chrome 上不起作用,他们是否有任何现代且未被弃用的技术的替代品?
Adobe produced a competing product called Adobe AIR - http://www.adobe.com/products/air.html. This product offers a limited intersection of features available in hta's. Local file access is restricted to a specific path, and generally access to the parent operating system is very restricted. However they do operate across all major platforms, including mobile devices, so they are probably the technology you are looking for. AIR uses webkit for the embedded browser engine.
Adobe 生产了一款名为 Adobe AIR 的竞争产品 - http://www.adobe.com/products/air.html。该产品提供了 hta 中可用功能的有限交集。本地文件访问受限于特定路径,一般访问父操作系统是非常受限的。然而,它们确实在所有主要平台上运行,包括移动设备,因此它们可能是您正在寻找的技术。AIR 使用 webkit 作为嵌入式浏览器引擎。
回答by JohnDoe
I wouldn't try to use a .HTA file, I would use Node-Webkit. Node-Webkit will let you do the same things as .HTA files will, but Node-Webkit seems to be faster and it is better supported. https://github.com/rogerwang/node-webkit; https://github.com/rogerwang/node-webkit/wiki/Manifest-format. Also, with Node-Webkit you can use node.js and easily make your program cross-platform too.
我不会尝试使用 .HTA 文件,我会使用 Node-Webkit。Node-Webkit 可以让您做与 .HTA 文件相同的事情,但 Node-Webkit 似乎更快,并且得到更好的支持。https://github.com/rogerwang/node-webkit; https://github.com/rogerwang/node-webkit/wiki/Manifest-format。此外,借助 Node-Webkit,您可以使用 node.js 并轻松地使您的程序跨平台。
回答by aWebDeveloper
回答by justin phelps
An update for this old, but still relevant question.
这个旧但仍然相关的问题的更新。
mhtml / mht, "MIME HTML" might be a simple solution. From: https://whatis.techtarget.com/fileformat/MHTML-MHTML-document-MIME
mhtml / mht,“MIME HTML”可能是一个简单的解决方案。来自:https: //whatis.techtarget.com/fileformat/MHTML-MHTML-document-MIME
MHTML (short for MIME HTML) is a file extension for a Web page archive file format as saved by Internet Explorer. The archived Web page is an MHTML document. MHTML saves the Web page content and incorporates external resources, such as images, applets, Flash animations and so on, into HTML documents.
MHTML(MIME HTML 的缩写)是 Internet Explorer 保存的网页存档文件格式的文件扩展名。存档的网页是一个 MHTML 文档。MHTML 保存网页内容并将外部资源,如图像、小程序、Flash 动画等合并到 HTML 文档中。
At the time of writing, I have tested native support for the following browsers:
在撰写本文时,我已经测试了对以下浏览器的原生支持:
- YES Chrome 81.0.4044.138
- YES Opera 68.0.3618.104
- NO Firefox 76.0.1
- NO Safari Version 13.1 (15609.1.20.111.8)
- 是 Chrome 81.0.4044.138
- 是歌剧 68.0.3618.104
- 没有 Firefox 76.0.1
- 没有 Safari 版本 13.1 (15609.1.20.111.8)
Chrome has added, removed and re-added support for mhtml in the last year, so an investment there is shaky. Safari has native support for MAFF, but not mhtml Firefox can support mhtml via plugin. Other browsers not tested, but MSIE had has support for it.
Chrome 在去年添加、删除和重新添加了对 mhtml 的支持,因此投资不稳定。Safari 原生支持 MAFF,但不是 mhtml Firefox 可以通过插件支持 mhtml。其他浏览器未测试,但 MSIE 已经支持它。