Posts Tagged “html5”

Load Your JavaScript Library Asynchronously

Lets imagine, we have a common page:

<!DOCTYPE html>
<html>
  <head>
    <script src="app.js"></script>
    <script>
      App.init('greeting', 'Hello, John Doe!');
    </script>
  </head>
  <body>
    <h1 id="greeting"></h1>
  </body>
</html>

With javascript library included:

// app.js
var App = {
  /**
   * Handle already registered actions.
   *
   * @param  {String} id   Element ID
   * @param  {String} name User's name
   */
  init: function (id, name) {
    document.getElementById(id).text(name);
  }
}

Read More