从另一个浏览器打开一个浏览器 [英] Opening one browser from another browser

查看:239
本文介绍了从另一个浏览器打开一个浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Firefox上运行我的Web应用程序。我在其中一个页面上有超链接,当我点击它时,它会打开另一个应用程序作为新的弹出窗口。
但Firefox不支持该应用程序。所以我想在Internet Explorer中打开它,即,虽然我在Firefox上运行应用程序,但是特定的弹出窗口应该在Internet Explorer中打开。我用它来打开新窗口:

I am running my web application on Firefox. I have hyperlink on one of the page and when I click on it, it opens another application as a new popup. But that application is not supported on Firefox. So I want to open it in Internet Explorer, i.e., though I am running the application on Firefox, that particular popup should open in Internet explorer. I am using this to open new window:

var win = window.open(url, "NewWindow", strFeatures);


推荐答案

你不能只用普通的JavaScript做到这一点;正如Levi所说,如果可以的话,这将是一个可用性和安全性的噩梦。

You can't do this with just ordinary JavaScript; as Levi notes, if you could, that would be a usability and security nightmare.

这就是说,有几种方法可以让这样的东西起作用。例如, a Firefox附加组件可以启动外部程序,因此您可以编写这样的附加组件以在IE中打开您的应用程序,并要求您的用户安装它(或让管理员为他们预先安装它,如果这样例如,对于托管工作场所设置中的内部应用程序。)

That said, there are a couple of ways you could get something like this to work. For example, a Firefox add-on can launch external programs, so you could write such an add-on to open your app in IE, and ask your users to install it (or have an admin pre-install it for them, if this is e.g. for an in-house app in a managed workplace setting).

另一种可能是使用自定义URL方案(如 myapp: )链接到您的应用程序,并注册该URL在IE中打开的方案(或者更确切地说,在某种包含自定义URL的包装脚本中,将其转换为普通的HTTP URL,并在IE中打开它)。但是,这需要配置(并且可能在最终用户的计算机上安装脚本),因此它可能仅适用于办公室或类似环境。

Another possibility might be to use a custom URL scheme (like myapp:) to link to your application, and register that URL scheme to be opened in IE (or, rather, in some kind of a wrapper script that takes the custom URL, converts it to a normal HTTP URL, and opens it in IE). Again, though, this requires configuring (and, probably, installing a script on) the end-user's computer, so it's probably only suited for office or similar environments.

注意这两种解决方案都具有安全隐患,您应该牢记这一点。特别是,您使用的任何加载项或脚本都应适用于指向您应用的特定网址,并且应拒绝打开某人可能尝试提供的任何其他网址。

Note that both of these solutions have security implications that you should keep in mind. In particular, any add-on or script you use for them should only work for specific URLs that point to your app, and should refuse to open any other URLs someone might try to feed it.

在任何情况下,如果您尝试为公共网站执行此操作,请记住没有办法您可以为Linux工作/ Mac用户 IE开头。甚至许多Windows用户可能不愿意使用IE(更不用说安装不受信任的扩展!)而没有非常的充分理由;毕竟,这可能是他们首先选择使用Firefox(或Chrome或Opera或其他)的原因。

In any case, if you're trying to do this for a public website, keep in mind that there's no way you can make this work for Linux / Mac users who don't have IE to begin with. And even many Windows users might be reluctant to use IE (not to mention installing an untrusted extension!) without a very good reason; after all, there's presumably a reason why they chose to use Firefox (or Chrome or Opera or whatever) in the first place.

这篇关于从另一个浏览器打开一个浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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