我怎样才能打开从HTA的默认Web浏览器的链接? [英] How can I open a link in the default web browser from an HTA?

查看:841
本文介绍了我怎样才能打开从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>

这篇关于我怎样才能打开从HTA的默认Web浏览器的链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆