Defering Javascript - Async

Posted on 2013-09-24
Medium Priority
Last Modified: 2013-12-15
I tried to load javascript async to speed up the page.  I have 10 different scripts on a page and would like to load all of them in async mode so I started beggining with a single javascript.

I'm using this code to load javascript in anync mode but other scripts which are not async stop working when I insert it. I just can't find out why.  

window.onload = function() {
   var s = document.createElement("script");
   s.src = "/js/cont.js";

Open in new window

Question by:seopti
  • 2
LVL 58

Accepted Solution

Gary earned 2000 total points
ID: 39519520
Are you following the logic I gave you here

Edited with correct link.
LVL 43

Expert Comment

ID: 39675104
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
LVL 58

Expert Comment

ID: 39675105
Think my link to the other question answers it.
Even if it is a circular reference...

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
AngularJS web development a very simple procedure. So, to put it, in short, AngularJS’ stand out features are – Two-way data binding, MVC structure, directives, templates, dependency injections and testing.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question