head 动态添加script标签

head 动态添加script标签

//字符串中有script标签需要替换掉

   var datas=""
	let script=document.createElement('script');
	var scripts=datas.replace(/<\/?.+?>/g,"");
	script.innerHTML=scripts; 
	document.getElementsByTagName('head')[0].appendChild(script);

你可能感兴趣的:(head添加script标签,javascript,前端,html)