The question is pretty simple: why is nither of those are working when they should? Tried in latest chrome and FF
document.addEventListener("DOMContentLoaded", function() {
alert("window on domcontentready");
}, false);
window.onload = function() {
alert("window on load");
}
The JavaScript is loaded on onload (inside jsfiddle), so onload won't fire, because it already fired.
Switch onload
to no wrap - in <head>
.