0
我有一些跟踪代码,我必须将其嵌入到页面的页脚中。跟踪代码来自第三方公司,并使用document.write
,这当然是阻止的。我向公司发送了支持请求,他们似乎没有任何兴趣来更改代码。document.write异步(JavaScript)
跟踪代码看起来是这样的:
document.write (
'<img src="http://company-url.com/visitor.gif?ts='+
new Date().getTime()+
'&ref='+escape(document.referrer) + '">'
);
所以,我的问题是,是否有可能使document.write
非阻塞?
你是什么意思?你能不能把它重写成'document.getElementById('footer')。innerHTML ='''? – putvande
如果我有选择,我不会在*全部*处使用'document.write'! – MackieeE
所以你知道,它不是'document.write',而是所有的脚本执行都被阻塞,除非你使用像'defer'或'async'这样的东西。但是'document.write'不再有效。 – Jacob