在谷歌浏览器以外的所有浏览器中显示提醒

时间:2015-04-03 10:27:03

标签: html google-chrome cross-browser dreamweaver

我当前的网页只能在Google Chrome中正常显示。因此,我想让谷歌浏览器以外的其他浏览器弹出一个说“#34;请使用谷歌浏览器"。

目前我正在使用

     提醒("请使用Google Chrome");   

但问题在于它还会在Google Chrome中显示该警报。有没有办法只在特定的浏览器中显示此警报?

1 个答案:

答案 0 :(得分:2)

var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;

这会检查浏览器是否为chrome,现在您可以执行以下操作:

if (is_chrome != true) {alert("Please use Google Chrome")}

if (is_chrome != true) {prompt("Please use Google Chrome Download it here:", "https://www.google.com/chrome/browser/index.html")}
相关问题