JSON undefined

It's taken me 6 hours of fiddling about to discover that the reason my openWebPage() is failing on the emulator is due to the fact that the webBrowser doesn't support JSON.
Is there a setting to enable JSON in a web page?

try{
data = JSON.parse(rawData);
}
catch(e){
document.getElementById("error").innerText =e.message ;

}
{/code]
returns

'JSON' is undefined
  • Hey,

    I've had a chat with one of our engineers about this. This should be populating the native browser for whatever system you are using. What system are you using to develop?

    Thanks,
    -Coleman
  • Hey,

    I think we may have found the root issue here. It looks like the browser interface we are using defaults to IE7 compatibility mode. A fix could be implemented via some registry items. We are understandably reluctant to do any quick patches with anything dealing with registries. For reference I have this link: https://msdn.microsoft.com/en-us/library/ee330730(v=vs.85).aspx

    On the upshot, we do know about it and have a ticket created to investigate possible fixes/have a fix identified if we need it. Thanks for your help.

    -Coleman
  • When I display the windows.userAgent from my page opened from openWebPage() running in the emulator, I get:
    User Agent:Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729)
    When I run it from my Chrome browser on my W10 box, I get :
    User Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
    from Edge I get:
    User Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586
    from IE, I get:
    User Agent:Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; rv:11.0) like Gecko
    from Firefox:
    User Agent:Mozilla/5.0 (Windows NT 10.0; WOW64; rv:48.0) Gecko/20100101 Firefox/48.0


    I only see Mozilla/4.0 in the emulator, all the other browsers report Mozilla/5.0. I don't think it's anything to do with registry settings, it looks like you've packaged a very old browser in the emulator.

    I can't run the test on my watch as openWebPage is not opening any browser on Android or iPhone. (Android doesn't provide Notification to open web browser, iPhone crashes GCM).

    Update:
    openWebView doesn't crash GCM on iPhone (something else is doing that), but it doesn't open the web browser either. I get a message "Open in Safari?" in GCM but the "Open" option closes the dialog and fails to open Safari.
  • Further evidence that the emulator is using an obsolete web browser (IE/7, Mozilla/4.0)

    The page I'm accessing with openWebPage, makes a cross-domain call to a database which is failing to be executed.

    I have enabled "Access data sources across domains" in my installed version of IE 11 which enables the calls to operate successfully from the browser, but it still fails when called from openWebPage().

    I think I have found references that IE/7 did not provide support for CORS (Cross Origin Resource Sharing) which could be the problem.

    IE/8 (with CORS capability through Mozilla/5.0) was released in March 2009.
  • According to the wxWidgets docs:
    The IE backend uses Microsoft's Trident rendering engine, specifically the version used by the locally installed copy of Internet Explorer. As such it is only available for the MSW port. By default recent versions of the WebBrowser control, which this backend uses, emulate Internet Explorer 7. This can be changed with a registry setting, see this article for more information. This backend has full support for custom schemes and virtual file systems.


    Source: http://docs.wxwidgets.org/trunk/classwx_web_view.html

    So it's not necessarily that it is packaged with an old browser. Rather, the simulator references the default settings per machine. On Windows it appears that this run IE in 7 Compatibility mode based on the machine. We do have a ticket to decide how to deal with it in the long term, but according to wxWidgets it is fixed via the linked registry change.

    Thanks,
    -Coleman
  • OK, I'm officially out of my depth here! I guess the linked documents make sense to some folks, but it's mostly Greek to me! It prompted me to examine my registry settings, but I didn't get very far as I couldn't match my settings to the examples in the doc. Why MSW embedded their browser so deeply in the OS has always been a source of amazement to me.
    I look forward to further updates.