2016年8月,YouTube IFrame API在Internet Explorer 8中停止运行。请尝试以下代码(只需将其复制并粘贴到本地服务器的html页面中)。它在除IE8之外的所有浏览器中都可以正常工作。
您能否建议一个解决方案或解决方法?非常感谢。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta id="viewport" name="viewport" content="initial-scale=1.0" />
<script type="text/javascript" src="https://www.youtube.com/iframe_api"></script>
<title></title>
</head>
<body onload='frmHelpVideo_startup();'>
<form method="POST" action=''>
<div>LAUNCHING PLAYER IN 5 SECONDS (IT FAILS IN IE8. HOW TO FIX?) . . . </div>
<div id='diviframeVideoHelp'></div>
</form>
</body>
<script type='text/javascript'>
var playerHelp = null;
function frmHelpVideo_startup(){
window.setTimeout(function(){frmHelpVideo_player_init();}, 5000);
}
function frmHelpVideo_player_init(){
playerHelp = new YT.Player ('diviframeVideoHelp', {
playerVars: {controls: 1, showInfo:0},
events: {'onReady': Player_help_event_handler_ready, 'onStateChange': Player_help_event_handler_state_change, 'onError': Player_help_event_handler_error}
}
);
}
function Player_help_event_handler_ready(event){
playerHelp.loadVideoById('1Ugle4aIous');
}
function Player_help_event_handler_state_change(event){
}
function Player_help_event_handler_error(event){
}
</script>
</html>