我正在尝试按照这里解释的方式异步加载Deezer JS:http://developers.deezer.com/sdk/javascript/init
使用一个空页面并精确复制所提供的示例,我会得到一个错误:
Cannot read property 'length' of null dz.js:67
TypeError: Cannot read property 'length' of null
at Object.DZ.Event.resolve (http://cdn-files.deezer.com/js/min/dz.js:59:138)
at Array.<anonymous> (http://cdn-files.deezer.com/js/min/dz.js:150:10)
at Object.DZ.Event.triggerEvent (http://cdn-files.deezer.com/js/min/dz.js:62:342)
at Object.DZ.player.onLoad (http://cdn-files.deezer.com/js/min/dz.js:143:10)
at DZ.onDeezerLoaded (http://cdn-files.deezer.com/js/min/dz.js:7:52)
at DZ.communication.receive (http://cdn-files.deezer.com/js/min/dz.js:109:1) 下面是我使用的代码:
<div id="dz-root"></div>
<script>
window.dzAsyncInit = function() {
DZ.init({
appId : 'xxxxx',
channelUrl : 'http://www.blbablalba.com/channel.php'
});
};
(function() {
var e = document.createElement('script');
e.src = 'http://cdn-files.deezer.com/js/min/dz.js';
e.async = true;
document.getElementById('dz-root').appendChild(e);
}());
</script>我是不是遗漏了什么?
发布于 2016-09-27 20:06:23
我知道这是一个老问题,但我今天遇到了同样的问题,并意识到document.body.innerHTML的值的修改导致了这个问题。
=>删除该行代码解决了这个问题!:-)
https://stackoverflow.com/questions/20818114
复制相似问题