javascript - Mixing html5 with non-async tags -


After some interesting conversation on Async, I could not find any information about what happened if you followed the regular script tag, followed with an async.

I tried to do a quick test and what do I expect to do this: if I have placed a non-async tag for the first time, it always seems to load it later async Responsible tag Here I am testing that code:

test.html:

  & lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Trial & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Script src = "https://code.jquery.com/jquery-2.1.1.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "test.js" async & gt; & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

test.js:

  warning (window .jquery);   

In every case it seems that jQuery loading. Maybe I'm missing something in my tests, is that right? Can I have dependency in the non-async tag and then the dependents who use the async? Is it particularly beneficial to do this?

Has anyone found it? What if you had some asyncs and then a non-async? Is loading async'd js?

Block the processing of non-async script tag pages. The browser can look forward and load test.js before jquery is executed, but the browser can not process the script because it does not know what the jquery for the page is (document.witail, window object is changing ..).

So, yes it will work

By doing so, the page will load slightly faster, because one of the two scripts can be loaded asynchronously. This will probably not match the startup time of the optimization, asynchronous loader.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -