Can I prevent history.popstate from triggering on initial page-load?

Using the native HTML5 History API you’re going to run into some problems, every HTML5 browser handles the API a little bit differently so you can’t just code it once and expect it to work without implementing workarounds. History.js provides a cross-browser API for the HTML5 History API and a optional hashchange fallback for HTML4 … Read more

jQuery.getScript alternative in native JavaScript

Here’s a jQuery getScript alternative with callback functionality: function getScript(source, callback) { var script = document.createElement(‘script’); var prior = document.getElementsByTagName(‘script’)[0]; script.async = 1; script.onload = script.onreadystatechange = function( _, isAbort ) { if(isAbort || !script.readyState || /loaded|complete/.test(script.readyState) ) { script.onload = script.onreadystatechange = null; script = undefined; if(!isAbort && callback) setTimeout(callback, 0); } }; script.src … Read more