如果用户使用过时的浏览器,我有一个页面会提示安装Google Chrome Frame 。
如果用户选择安装插件,它会很好用。但是,如果他/她选择不安装并关闭该层;使用相同的按钮再次打开图层是不可能的。(基本上它只工作一次。)
每次点击安装时,有什么方法可以强制打开 Google Chrome Frame?
(我试过强制使用 cookie,但似乎没有用。)
更新 [#1]:
测试页面在这里。
<!doctype html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<!--[if IE]>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js"></script>
<![endif]-->
</head>
<body>
<a href="#" class="dngcf">Prompt</a>
<script>
$(function(){
if( $.browser.msie && $.browser.version < 9 ){
if( navigator.userAgent.indexOf('chromeframe') < 0 ){
$('.dngcf').bind('click', function(){
//document.cookie = 'disableGCFCheck=0;path=/;';
CFInstall.check({
url: 'http://www.google.com/chromeframe/eula.html?user=true',
mode: "overlay",
destination: "http://mywebsite.com"
});
});
}else{
alert('GCF is already installed');
}
}else{
alert('You need IE 6, 7 or 8 in order to see the "bug".');
}
});
</script>
</body>
</html>
更新[#2]:
这似乎是一个与会话相关的问题。
当我重新启动浏览器时,链接再次工作一次。但是当我只刷新页面时不会。
[结论]
这种行为是设计使然。它允许管理员check()
在每个页面上使用 GCF,而不会每次都用提示来烦扰用户。
接受的答案允许您规避这种行为。