I am getting following error on my IE 8 page (The page is running fine in other browsers).
User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Wed, 10 Sep 2014 06:48:45 UTC
Message: Object doesn't support this property or method
Line: 70532
Char: 5
Code: 0
When I checked the line 70532 in the file mentioned, i saw this code:
if (!Object.create && !Object.create(null).hasOwnProperty) {
throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: ");
}
What does it meant by Please polyfil with es5-sham:
Please polyfil with es5-sham:
How can I fix this error.
I am getting following error on my IE 8 page (The page is running fine in other browsers).
User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Wed, 10 Sep 2014 06:48:45 UTC
Message: Object doesn't support this property or method
Line: 70532
Char: 5
Code: 0
When I checked the line 70532 in the file mentioned, i saw this code:
if (!Object.create && !Object.create(null).hasOwnProperty) {
throw new Error("This browser does not support Object.create(null), please polyfil with es5-sham: http://git.io/yBU2rg");
}
What does it meant by Please polyfil with es5-sham:
Please polyfil with es5-sham: http://git.io/yBU2rg
How can I fix this error.
Share Improve this question edited Sep 10, 2014 at 8:52 SharpCoder asked Sep 10, 2014 at 7:53 SharpCoderSharpCoder 19.2k43 gold badges163 silver badges258 bronze badges2 Answers
Reset to default 4Object.create
is not supported in IE8, therefore your framework is asking you to "polyfil" it, which means you need to implement something which should have been supported natively, but for some reason, this particular environment doesn't know about it.
It means, if you want to use Object.create
you have to implement it yourself. Fortunatelly, you don't have to do much, the url ( https://github./es-shims/es5-shim/blob/master/es5-sham.js) points to a file which contains the neccesary polyfills.
Just run that script before your framework script does.
update:
This line seems broken to me: !Object.create && !Object.create(null).hasOwnProperty
.
If Object.create
is not there, calling it like Object.create(null)
should throw an error, but I think it should be something like 'undefined is not a function'.
I found another polyfil which is working in my scenario. I found the answer at this link.
I am adding code form that link
if (!Object.create) {
Object.create = function(proto, props) {
if (typeof props !== "undefined") {
throw "The multiple-argument version of Object.create is not provided by this browser and cannot be shimmed.";
}
function ctor() { }
ctor.prototype = proto;
return new ctor();
};
}
adding this code seems to be doing trick for me. Only change I made is, I mented the code where exception is thrown as it is resulting in another error.