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