我怎样才能打开从HTA的默认Web浏览器的链接?

问题描述:

我的工作是作为一个HTA实现的应用程序。我有一系列的我想有在系统的默认浏览器中打开链接。使用< A HREF =网址目标=_空白方式> 打开IE浏览器中的链接而不管默认浏览器

I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <a href="url" target="_blank"> opens the link in IE regardless of the default browser.

有没有办法使用默认浏览器的方法吗?使用JavaScript是一种选择。

Is there a way to use the default browser? Using JavaScript is an option.

创建一个shell并尝试运行一个URL。

Create a shell and attempt to run a URL.

这对我的作品(保存为whatever.hta和执行它)我的系统上。点击按钮在Firefox打开谷歌:

This works for me (save as whatever.hta and execute it) on my system. Clicking on the button opens Google in Firefox:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
  <title>HTA Test</title>
  <hta:application applicationname="HTA Test" scroll="yes" singleinstance="yes">
  <script type="text/javascript">
  function openURL()
  {
      var shell = new ActiveXObject("WScript.Shell");
      shell.run("http://www.google.com");
  }
  </script>
</head>
<body>

<input type="button" onclick="openURL()" value="Open Google">

</body>
</html>