Page 1 of 1

Does anybody know why some javascript functions don't work with ActiveX control?

Posted: 24 Jul 2021, 18:54
by guest2233344
I have Internet Explorer 9 installed and some functions like "JSON.parse()" or "Object.keys()" simply don't work with the ActiveX control.

Any suggestions?

Re: Does anybody know why some javascript functions don't work with ActiveX control?

Posted: 24 Jul 2021, 19:10
by lexikos
Internet Explorer 9? :eh: Are you using Vista?

WebBrowser controls operate in IE7-compatibility mode by default, although I'm not sure how that affects the JavaScript environment. There are at least two ways around it:
  • Include <meta http-equiv='X-UA-Compatible' content='IE=edge'> in the document.
  • Use a registry fix (search the forum for FixIE).

Re: Does anybody know why some javascript functions don't work with ActiveX control?

Posted: 24 Jul 2021, 19:55
by malcev
Work with json object without eval You can only from IE8.
If You want to work with them in earlier IE versions You can do it with this trick:

Code: Select all

doc := ComObjCreate("htmlfile")
doc.write("<meta http-equiv=""X-UA-Compatible"" content=""IE=5"">")
msgbox % Doc.documentMode
JS := doc.parentWindow
JS.execScript(" ")   ; Initializing the JavaScript interpreter for IE < IE9
msgbox, % JS.eval("({""key"":""value""})").key