Moxie undefined but very clearly defined

I pull my hair on top of IE9 / 8; I am trying to use mOxie , but it appears as undefined , although it is very clearly defined.

when I write mOxie to the console from another file, it writes it fine in Chrome / IE10 +, but runs the same script in IE9 / 8 undefined logs.

However, in IE9 / 8, when I type 'mOxie' in the console directly, it correctly registers the object.

http://jsfiddle.net/vxyayxy8/ - Run in IE10 mode and you will see that it loads the object. Run in IE9 mode and you will see that it registers undefined

Why in IE9 / 8 when registering from a file (which is included after mOxie) is it undefined , but defined in IE9 / 8 when using the console directly?

Keep in mind that it is defined in Chrome and IE10 +.

To test the theory of my answer below in IE11, but in IE9 document mode, console.log({}) - I get undefined , which corresponds to the question and answer. Can you reproduce this?

+5
source share
1 answer

The answer below is still legal, but apparently it is due to an IE error, which I am now sure has been fixed, so I am installing updates and hope for the best. Thanks for the help guys.

I found that running console.log in IE8 / 9 document mode (yes, devtools are open) leads to undefined .

Why they register the object as undefined outside of me, but the fix is ​​to use console.dir , which leads to the correct logging of the object on the console.

mOxie never undefined , it was simply recorded as such through IE's fancy console implementation.

Despite the fact that I am getting allegations that the problem cannot be reproduced, I can still get the same results as myself when I test it. http://jsfiddle.net/vxyayxy8/1/ - shows how the log returns undefined, vs dir, which returns an object.

asdf

+6
source

Source: https://habr.com/ru/post/1212453/


All Articles