Implied globals in browsers

Stoyan Stefanov has done some testing on so called implied globals in browsers. One of the interesting finds was that the meta description is accessible in JavaScript using object property notation on IE and other browsers.

HTML:

  1. <meta name=“description” content=“test me” />
JAVASCRIPT:

  1. alert(description.content); // "test me"
  2.  

Furthermore, you can use document.getElementById('description') will give you that DOM node although it has no ID!

Stoyan has a test page up to see what browser behaves that way and there’s an interesting comparison table in the blog post. Also be sure to check the comments for more baffling findings.

 

Leave a Reply

You must be logged in to post a comment.



Play Bingo 

If you love games then you should play bingo. Stop by paddypowerbingo for everything bingo related.