我可能错过了一些大事,但我已经尝试了几个小时......
因此,为了让 IE 8 及以下版本的用户安装Chrome Frame,我尝试了提供的 GCF Install JS 文件,但我更喜欢自己的实现 - GCFInstall JS 将让弹出窗口在每个会话中仅打开一次,即使通过按钮调用也是如此第二次。如果您第二次打开它,我发现的唯一解决方案不允许您关闭它。
所以这是我放在页面上的代码:
HTML:
<!--[if lt IE 9]><script type="text/javascript" src="/resources/js/getgcf.js"></script>
<div style="border:1px solid black; padding: 3px;"><img src="http://cdn.dustball.com/information.png" alt="info"> You appear to be using an older version of Internet Explorer. This website relies on technology not supported by Internet Explorer. To improve your experience (and fix layout errors):
<br><button id="gcfdl">Activate Google Chrome Frame</button><br>You won't notice anything different in the way you use the internet, except that most websites will look better.</div><![endif]-->
getgcf.js:
$("#gcfdl").click(function(){
var wants_normal_installation = confirm("You will now be taken to google.com/chromeframe where Google Chrome Frame will be activated. Please wait about 10 seconds after clicking Accept and Install, and you will automatically be taken back to this page. Press OK for normal installation (recommended), or Cancel for single-user installation (use if you don't have administrator rights on your computer):");
if(wants_normal_installation){
window.location("http://www.google.com/chromeframe?redirect=true");
}
else{
window.location("http://www.google.com/chromeframe?user=true&redirect=true");
}
});
是的——就是这么简单。jQuery 通常可以完美运行 :(
IE 确实显示“页面上的错误”,但是当我单击它时,消息显示一个令人困惑的错误,我无法弄清楚它的含义。
我将代码放入 Chrome 中,它给出了另一个控制台消息,我无法理解......
任何帮助,将不胜感激。谢谢。