我想动态加载这个脚本,它包含数据属性
<script class="podigee-podcast-player"
src="https://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js" data-configuration="https://pt.podigee.io/embed?context=external">
</script>
我试过了。但这对我不起作用。这是设置数据配置属性的正确方法吗?我在哪里犯错?
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = 'https://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js';
script.class = 'podigee-podcast-player';
script.dataset.configuration = 'https://pt.podigee.io/embed?context=external';
var s = document.getElementsByTagName("body")[0].appendChild(script, s);