简体   繁体   English

强制IE中的链接在Firefox中打开

[英]Force a link in I.E. to open in Firefox

I have two links in a corporate intranet site, built in Sharepoint, that I need to link to Firefox. 我在Sharepoint内置的公司Intranet站点中有两个链接,需要链接到Firefox。 The links are to an external site that does not work in IE However, the corporate browser is IE, so that's what most people see. 链接是指向无法在IE中运行的外部站点的。但是,公司浏览器是IE,因此大多数人都可以看到。

I found the below code that works when I have one link. 当我有一个链接时,我发现以下代码有效。 How do I get it to work for two links? 如何使它适用于两个链接?

Here's the code: 这是代码:

<!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>

You can modify your script to something like: 您可以将脚本修改为:

<script type="text/javascript">
function openURL(url)
{
    var shell = new ActiveXObject("WScript.Shell");
    shell.run(url);
}
</script>
</head>
<body>

<input type="button" onclick="openURL('http://www.google.com')" value="Open Google">
<input type="button" onclick="openURL('http://www.yahoo.com')" value="Open Yahoo">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 javascript在IE 9和Firefox中均不起作用 - javascript not working in I.E. 9 as well as Firefox 强制JSON.stringify转义正斜杠(即`\ /`) - Force JSON.stringify to escape forward slash (i.e. `\/`) window.open和安全设置的问题 - problems with window.open and i.e. security settings 我可以强制在特定浏览器中打开链接吗? - Can I force a link to open in a specific browser? 如何强制jQuery UI Selectmenu出现在jQuery模式窗口的上方(即前面)? - How do I force jQuery UI Selectmenu to appear above (i.e. in front of) a jQuery modal window? 如何强制在JSP(即不是PHP)上重新加载缓存的css文件? - How can I force a cached css file to be reloaded on a JSP (i.e. not PHP)? 如何在 setState 之后在 React 中强制立即更新 DOM(即提交)? - How can I force an immediate DOM update (i.e. commit) in React after setState? 如何根据浏览器(即Blackberry 8300)在网页上强制禁用JavaScript? - How to force JavaScript as disabled on a webpage depending on browser (i.e. on Blackberry 8300)? AngularJS:在长时间运行的循环中强制DOM更新(即进度指示器) - AngularJS: force DOM update during long-running loop (i.e. progress indicator) Firefox 4:动态打开 window 在旧 window 中打开新标签(即 Z05B8C74CBD962FBF2DE4C1A3527)。 - Firefox 4: Dynamically opened window opens new tabs in old window (i.e. window.opener)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM