I'm not a JavaScript expert, but having run Pagespeed on one of my websites I got the following error message
"Eliminate external render-blocking Javascript and CSS in above-the-fold content Your page has 1 blocking script resources and 1 blocking CSS resources."
Firstly I moved the offending JavaScript to just before the </body> tag but I still got the PageSpeed error message.
After much digging I came across this excellent article about
Deferred Javascript Loading where I found the problem...my deferred javascript uses
document.write()
Apparently the deferred javascript loading method doesn't work if the deferred code includes document.write (it actually blanks the page in my case).
Does anyone have any alternatives if you want to defer JavaScript which uses document.write() ?
Many thanks