TL;DR
Use contentloaded.js by dperiri.
<script>contentLoaded(window, function() { console.log("loaded");});</script>
If you can use jQuery.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script>$(document).ready( function() { console.log("loaded");}); </script>
If you don't want any dependency, use window.onload (not really DOM ready, but the entire page is loaded including css, scripts, images, etc.).
<script>window.onload = function() { console.log("loaded");};</script>
window.onload
window.onload is the most widely supported, where it's called when the page loads all its content (images, css, scripts, etc.).
<script>window.onload = function() { console.log("loaded");};</script>
document.onload
document.onload is triggered when the DOM is ready, but it might not be well supported on all browser.
<script>document.onload = function() { console.log("loaded");};</script>
DOMContentLoaded
DOMContentLoaded is triggered when the DOM is ready, but support is not universal (minimum of IE9 is required).
<script>document.addEventListener("DOMContentLoaded", function(event) { console.log("loaded");});</script>
Using jQuery
jQuery provide well good cross browser support.
Equivalent of document.onload (DOM ready).
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script><script>$(document).ready( function() { console.log("loaded");}); </script>
Equivalent of window.onload (Page ready).
<script>$(window).load( function() { console.log("loaded");});</script>