Google Maps Script error in Onion.js

后端 未结 6 1314
挽巷
挽巷 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:00

    Google launched a new release version 3.24 on May 24, 2016.

    According to the versioning model, there are only three versions: frozen, release and experimental.

    https://developers.google.com/maps/documentation/javascript/versions

    Version 3.22 is retired and cannot be accessed anymore.

    The new version supports only IE10 and IE11, the compatibility mode is unsupported.

    https://developers.google.com/maps/documentation/javascript/browsersupport

    WebBrowser control can default to an IE 7 rendering mode:

    https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version

    You should force the control to a newer IE version

    http://www.codeproject.com/Articles/793687/Configuring-the-emulation-mode-of-an-Internet-Expl

    Use latest version of Internet Explorer in the webbrowser control

    Additionally, you can add the meta tag in your html

    It looks like the new version of Maps JavaScript API relies on a global JSON object which is not available in IE7. So, alternatively you can try to polyfill JSON:

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON

    0 讨论(0)
  • 2020-12-19 01:01

    This onion.js script error has returned, the v=3.22 no longer fixes the issue. It turns out that the problem is an issue with IE and onios.js. Embedding a web browser by default used IE7 standard and that’s the problem my fix was an addition to the registry as follows:-

    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
    "yourApp.exe"=dword:00002EDF
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
    "yourApp.exe"=dword:00002EDF
    
    [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION]
    "yourApp.exe"=dword:00002EDF  
    
    0 讨论(0)
  • 2020-12-19 01:02

    Adding the following meta tag in a header section solved this issue for me.

     <meta http-equiv="X-UA-Compatible" content="IE=edge">
    
    • The X-UA-Compatible meta tag allows web authors to choose what version of Internet Explorer the page should be rendered as.
    • Edge mode tells Internet Explorer to display content in the highest mode available.
    0 讨论(0)
  • 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):

    '<script src="https://cdn.jsdelivr.net/json3/3.3.2/json3.js"></script>'  +
    

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

    0 讨论(0)
  • 2020-12-19 01:19

    I was having the same error. I've just found a solution that worked for me.

    I just added "&v=3.22" in the url of Google Maps. Like this:

    http://maps.google.com/maps/api/js?sensor=true&v=3.22

    0 讨论(0)
  • 2020-12-19 01:20

    I also changed this tag. then work it well. thanks

    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    

    It works both ver 3.22 & 3.23.

    0 讨论(0)
提交回复
热议问题