Google Maps Script error in Onion.js

后端 未结 6 1353
挽巷
挽巷 2020-12-19 00:53

This morning I just started getting a google maps script error.

Line: 0 Char: 0 Error: Script Error Code: 0 URL:

I reverted all my code changes ba

6条回答
  •  一整个雨季
    2020-12-19 01:16

    I was having a similar problem and the provided solution didn't work for me. I was getting the error in Delphi inside the TWebBrowser control also with the meta tag.

    I figured out the problem.

    Onion.js fires the error, because it calls JSON.parse.

    JSON Parse isn't supported by the web browser control. You can test this by adding this to your JavaScript (already quoted for Delphi):

    'var code = ''"\u2028\u2029"''; JSON.parse(code); ' +
    

    Every browser should execute

    var code = '"\u2028\u2029"';
    JSON.parse(code);
    

    When executed in Delphi it fires an error instantly.

    You can avoid the whole thing with a JSON3 polyfill (already quoted for Delphi):

    ''  +
    

    Then JSON will be defined and work as expected, resolving the problem.

提交回复
热议问题