Most likely the image hasn't fully loaded yet. Use an onload
handler.
var img = document.getElementsByTagName("img")[0];
img.onload = function() {
console.log( "\'img[0].namespaceURI\' results in " + this.namespaceURI );
console.log( "\'img[0].height\' results in " + this.height );
console.log(this);
};
If there's a possibility that the image is cached, then you can check its .complete
property and invoke the handler manually if needed.
if (img.complete)
img.onload();