I'm trying to use this solution -> http://stackoverflow.com/a/7410966/2007055
But why this code line with
var tags = document.body.getElementsByTagName("*");
Uncaught TypeError: Cannot read property 'getElementsByTagName' of null
document.body won't get a value assigned to it until the body element has been created.
<script> from the
<head> element to the
<body> element (since you are trying to get all the elements in it, you'd want to be at the end of the body element) or put it in a function and call it from an event that fires after the body has been created (such as the