this === window in firebug

Posted by Yousui on Stack Overflow See other posts from Stack Overflow or by Yousui
Published on 2010-03-09T02:20:14Z Indexed on 2010/03/09 2:21 UTC
Read the original article Hit count: 494

Filed under:
|
|
|

Hi guys,

I wrote a simple webpage as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>pop</title>
</head>
<body>
<script type="text/javascript" charset="utf-8">
document.write(this === window);
</script>
</body>
</html>

I browse this page using IE6 and FireFox 3.5.8, both give an answer true. But when I press F12 in FireFox and type this===window in the console, it will give me an answer false, why?

Great thanks.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox