Ok peep's so I have this code, but here's a simplified version:
<!DOCTYPE html>
<html>
<head>
<title>_</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script>
Object.defineProperty(
Array.prototype,'len',{get:
function(){return this.length}
});
function pop(){
ary=['abc',123];
d1.innerText=ary.len;
}
</script>
</head>
<body onload="pop()">
<div id="d1">d1</div>
</body>
</html>
So my setup is:
- Chrome v40.0.2214.94 m
- IE v11.0.9600.16428
- IIS v7.5.7600.16385
When I open either browser & open the above file as so:
IE ==> C:\site\proj\default.htm
Chrome ==> file:///C:/site/proj/default.htm
Both browsers display the correct result: 2
...
Yet when I open the file as so:
IE ==> http://portal/proj/default.htm
Chrome ==> http://portal/proj/default.htm
Where portal is the name of the localhost site, setup in IIS.
IE displays undefined
and throws a console error of:
Object doesn't support property or method 'defineProperty'
While Chrome still display 2
correctly.
So, I suppose my question is this...
Does IIS change the 'compatibility mode' of IE or something, or do I just need to update to a newer version of IIS?
Thinking Is...
I'm playing round with .hta
files for the first time & I was writing an Array.prototype.indexOf
property as I got a similar error message as above when trying to access .indexOf
on an array...
Thing is, I wanted to make the new indexOf
property enumerable, so I used Object.defineProperty
to set the property as enumerable, and that's how I ended up on Stack'...