IE9的dailymotion API postMessage错误

时间:2015-12-07 13:30:34

标签: internet-explorer-9 postmessage dailymotion-api

我想使用dailymotion播放器API,发布消息不适用于ie9(Windows 7)。

var dmplayer = document.getElementById("dmplayer");
var source = null;
var origin = null;
var postMessageListener = function (e) {
    if(source == null && (e.origin === "http://www.dailymotion.com" || e.origin === "https://www.dailymotion.com")){
        source = e.source;
        origin = e.origin;
    }
};        
window.attachEvent("onmessage", postMessageListener); //ie9 only
<iframe style="position:absolute;height:100%;width:100%;top:0;left:0;padding:0;margin:0;" src="http://www.dailymotion.com/embed/video/x2m8jpp?api=1&wmode=opaque" id="dmplayer" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

当我运行source.postMessage('play', origin)时 我收到这个错误:

  

对象不支持属性或方法'apply'x2m8jpp?api = 1&amp; wmode = opaque,line 1 character 1

有没有人有解决方案?

感谢。

0 个答案:

没有答案