简体   繁体   English

检测IE浏览器并使用chrome浏览器打开相同的url

[英]Detect IE browser and open the same url using chrome browser

I am using WordPress to build a project.我正在使用 WordPress 构建一个项目。 After adding a nice theme template, it looks nice using google chrome browser, however when using IE browser, some of the feature does not shown up.添加一个漂亮的主题模板后,使用google chrome浏览器看起来不错,但是使用IE浏览器时,某些功能没有显示出来。 So I was wondering is there some methods that could detect if user using IE browser and it could automatic open chrome and browse the same URL(saying all our user install chrome already), and close IE.所以我想知道是否有一些方法可以检测用户是否使用 IE 浏览器,它可以自动打开 chrome 并浏览相同的 URL(说我们所有的用户都已经安装了 chrome),然后关闭 IE。

Or is there any other approach to this problem?或者有没有其他方法可以解决这个问题?

You can't and shouldn't do this.你不能也不应该这样做。

JavaScript should not have access to the user's system, and also this is a terrible UI feature if it could be implemented. JavaScript 不应该访问用户的系统,如果可以实现,这也是一个糟糕的 UI 功能。

A better way to handle this is:更好的处理方法是:

  1. Detect IE and show some sort of alert that suggests they use a different browser检测 IE 并显示某种提示他们使用不同浏览器的警报
  2. Make your website compatible with IE to the extent that you feel comfortable使您的网站与 IE 兼容到您感觉舒适的程度

Best thing to do, if you gone to far into the project is to use different stylesheet for IE:最好的办法是,如果您深入到项目中,则为 IE 使用不同的样式表:

<!--[if IE]>
  <link href="IE-styles.css" />
<![endif]-->

Or, if there is a problem with specific version of IE use: (Targeting IE8, and older)或者,如果特定版本的 IE 有问题,请使用:(针对 IE8 及更早版本)

<!--[if lt IE 9]>
    <link rel="stylesheet" type="text/css" href="ie8-and-down.css" />
<![endif]-->

Hope this helps.希望这可以帮助。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM