Has anyone here tested JavaScript loading asynchronously in Plone? I'm using XSLT + Xpath in the Diazo rule and have success with transform to HTML, but, does not has load in correct order.
For eg, The JQuery library are load after all JavaScript's, causing an error with the others load.
Hi, Cleber! Not much experience with async but I think you should probably exclude jQuery and other harder dependencies from using it, since you can't make sure in which order they will be loaded and executed. Also I'd remove the type=text/javascript part since on HTML5 it's not required and might eventually get some of your scripts dropped. So I'd change first line to:
mmm, I think now I understand (and that's why is always better to give a small background on you use case and explain what are you trying to do and why are you trying to do it, instead of how are you trying to do it):
you're using Plone 4 and you want to execute a script registered globally in the resource registry asynchronously, right?
well, I think you can't do that besides hacking the HTML like you're doing using Diazo.
IIRC, Plone's resource registry predates the async attribute in HTML5.
the good news is I have an alternate solution for you: install collective.blueline and add manually your <script> tag in one of the available viewlets.
you can even place it in the footer, for best results.