大家好,又见面了,我是你们的朋友全栈君。
1.首先下载、安装Chrome Frame插件 (一定要发布到服务器上才起作用)
在线版很多,自己搜一下
离线版地址:http://download.csdn.net/detail/wd4java/8284975
安装成功后如上图
2.打开需要使用谷歌的页面
1、所有版本ie都使用谷歌插件
<meta http-equiv="X-UA-Compatible" content="chrome=1">
2、指定版本
<meta http-equiv=”X-UA-Compatible” content=”IE=Edge,chrome=IE6″>
3、检测Google Chrome框架并提示安装
<html>
<body>
<script type="text/javascript"
src="http://ajax.proxy.ustclug.org/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
/*
CSS rules to use for styling the overlay:
.chromeFrameOverlayContent
.chromeFrameOverlayContent iframe
.chromeFrameOverlayCloseBar
.chromeFrameOverlayUnderlay
*/
</style>
<script>
// You may want to place these lines inside an onload handler
CFInstall.check({
mode: "overlay",
destination: "http://www.waikiki.com"
});
</script>
</body>
</html>
4、
CFInstall.check()
mode
: optional
How the user should be prompted when GCF is missing. Defaults to a value ofinline
that puts an iframe in the document that points to the value ofurl
. If a value fornode
is specified this will control where the iframe is placed, else it will appear as the first child of the doucment’sbody
element. Ifmode
is set tooverlay
(recommended), an in-page dialog is displayed that floats over page content. If mode ispopup
, thenurl
is opened in a new (popup) window. It’s recommended that you only use a value ofpopup
when callingcheck()
from a user action, for instance theonclick
handler of abutton
element else popup blocking software may defeat the check.url
: optional
Defaults to “http://google.com/chromeframe”. Set this to change the URL that the prompt (either inline or in a popup) will navigate to. You might use this if you’re using GCF on an intranet or closed environment and you want to prompt users to install from an alternate location.destination
: optional
The URL to navigate to onceCFInstall
detects that GCF has been installed.node
: optional
The ID or reference to an element that will contain theiframe
prompt. If nonode
is provided, the promptiframe
will be inserted at the top of the document.onmissing
: optional
Function to be called when GCF is missing.preventPrompt
: optional
Boolean, defaults tofalse
, which allows you to disable the default prompting mechanism. Use in conjunction withonmissing
to implement your own prompt.oninstall
: optional
Function that will be called when GCF is first detected after an install prompt is displayed.preventInstallDetection
: optional
Boolean, defaults tofalse
. Set this totrue
to preventCFInstall
from checking whether GCF has been installed. Use this to prevent redirection.cssText
: optional
Style properties to apply to the promptiframe
whenmode
isinline
.className
: optional
CSS classes to apply to the promptiframe
whenmode
isinline
.
5、
CFInstall.check()例子
<html>
<body>
<!--[if IE]>
<script type="text/javascript"
src="http://ajax.proxy.ustclug.org/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
<style>
.chromeFrameInstallDefaultStyle {
width: 100%; /* default is 800px */
border: 5px solid blue;
}
</style>
<div id="prompt">
<!-- if IE without GCF, prompt goes here -->
</div>
<script>
// The conditional ensures that this code will only execute in IE,
// Therefore we can use the IE-specific attachEvent without worry
window.attachEvent("onload", function() {
CFInstall.check({
mode: "inline", // the default
node: "prompt"
});
});
</script>
<![endif]-->
</body>
</html>
详情请参考:http://www.chromium.org/developers/how-tos/chrome-frame-getting-started
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/160279.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...