And so, today I was reading someone's code and I saw the following statement:
url: 'http://' + top.location.host + ...
I don't know much about DOM parameters, so the
top
variable is totally new to me. As with (probably) most web developers I use the Firefox browser with the Firebug add-on (1.5.4). So, it is simple to see what the value of top
is. Open Firebug, go to the DOM tab, scroll down until you find 'top' in the tree, open each node until you find the value of top.location.host.Alternatively, if you click on the small red button on the lower right with the white triangle, you will open an interactive console window. Type
top.location.host
in this window and the value of the variable is reported in the main console.Google Chrome's Developer Tools can also return the value by simply typing the variable in the console window. (They even have statement completion... Fancy!)
I wanted to know a little more about this variable so, I went to Google and made the folowing search:
site:www.w3.org/DOM top
I got a sad collection of results. So, why do the browsers all contain this variable? That will be another question to answer along the way.
No comments:
Post a Comment