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

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
guest2233344

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

24 Jul 2021, 18:54

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?
Last edited by gregster on 24 Jul 2021, 19:06, edited 1 time in total.
Reason: Topic moved from 'Forum Issues'.
lexikos
Posts: 9587
Joined: 30 Sep 2013, 04:07
Contact:

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

24 Jul 2021, 19:10

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).
malcev
Posts: 1769
Joined: 12 Aug 2014, 12:37

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

24 Jul 2021, 19:55

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

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Joey5 and 287 guests