JavaScript代码强制HTML页面在Chrome浏览器中打开? [英] Javascript code to force html page to open in Chrome browser?

查看:1847
本文介绍了JavaScript代码强制HTML页面在Chrome浏览器中打开?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们在我们公司使用Google Apps,并且每个人都在其计算机上安装了Chrome。问题是,我们仍然必须使用IE浏览器进行某些操作。我在内部网站上有几个链接到Google文档的html文件,但它在IE浏览器中打开。我需要它来打开Chrome浏览器,以便用户在每次打开文件时都不必登录。我只有HTML文件设置的控制,所以有什么方法可以使用Javascript强制在Chrome中打开一个窗口?



谢谢!

$ b $我相信,如果你使用的是IE,你可以使用ActiveX来打开特定的程序。



例如尝试查看'新的ActiveXObject'



您必须明确地允许这个,但IE会证实您是否允许执行它。

 函数loadProg(path){
var active = new ActiveXObject(WScript.Shell);
activeX = active.Run(path);

$ / code>

如果您知道直接文件路径,请使用

  loadProg(path); 

更具体地说就像

  window.onload = function(){
loadProg(\C:\\ Program Files(x86)\\Guitar Pro 5 \\GP5.exe\\ \\ );
};

我不知道Chrome的路径,因此我使用了其他的东西。


We are using Google Apps at our company and everyone has Chrome installed on their computers. The problem is that we still have to use IE for certain things. I have a few html files on our intranet site that link to Google Docs, but it's opening in an IE browser. I need it to open a Chrome browser so the user doesn't have to sign in each time they open the file. I only have control of the html files settings so is there any way to use Javascript to force a window to open in Chrome?

Thanks!

解决方案

I believe that if you're using IE you can use ActiveX to open up specific programs.

For instance try looking at 'new ActiveXObject'

You must explicitly allow this however as IE confirms if you want to allow it to be executed.

function loadProg(path){
    var active = new ActiveXObject("WScript.Shell");
    activeX = active.Run(path);
}

If you know the direct file path use this like

loadProg(path);

More specifically like

window.onload = function(){
    loadProg("\"C:\\Program Files (x86)\\Guitar Pro 5\\GP5.exe\"");
};

I don't know the path to Chrome so i used something else instead.

这篇关于JavaScript代码强制HTML页面在Chrome浏览器中打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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