1. #1
    Sencha User
    Join Date
    Jun 2009
    Posts
    417
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default CMD build failing to add Google script includes to index.html?

    CMD build failing to add Google script includes to index.html?


    Hi,

    I have recently updated my ST 2.3.1 project to use CMD 5.0.2.250 beta and am facing an issue with a Google Maps script js reference I have in my app.json file:

    Code:
    {
                "path": "http://maps.google.com/maps/api/js?sensor=true",
                "remote": true
            }
    Im seeing in chrome debugging tools, that when the Google Maps script is attempted to be loaded into the document, this error:
    Code:
    Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
    Its doing this for both package and production builds I am trying out in the browser.

    I was not having issue's prior when using CMD 4.x, so is there some step I have missed moving over to 5?

    Can anyone advise further please?

    Thanks.

  2. #2
    Sencha - Senior Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,948
    Vote Rating
    953
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    What device/browser are you seeing this on?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Posts
    417
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    Just regular desktop Chrome

    Running built versions under iis too

  4. #4
    Sencha User
    Join Date
    Jun 2009
    Posts
    417
    Vote Rating
    2
    parky128 is on a distinguished road

      0  

    Default


    I have since tried rolling back to CMD 4, but I am still getting the same error for both production and package builds.

    If I run the application directly from the root, so my dev version, the Google Maps lib loads in fine.

    I just don't get what is going on here!

    Any help is much appreciated, really need to get my app deployed.

    Thanks

  5. #5
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    274
    Vote Rating
    36
    themightychris has a spectacular aura about themightychris has a spectacular aura about

      0  

    Default


    Also encountering this problem with ST 2.4 + any CMD version, maybe a recent change Google made to the maps loader isn't compatible with the timing of when the production microloader inserts remote script tags?
    Chief Architect @ Jarv.us Innovations
    Co-captain @ Code for Philly

    Jarvus builds and optimizes top-quality Sencha Touch and ExtJS apps for open-source projects and clients of all sizes.

    Don't waste time with bugs that have already been found and fixed by the community, compile our tried and tested hotfixes packages into all your projects: https://github.com/JarvusInnovations/sencha-hotfixes

  6. #6
    Sencha User
    Join Date
    Jan 2013
    Posts
    2
    Vote Rating
    0
    Maramazza is on a distinguished road

      0  

    Default


    I have already this problem..
    Any news?
    Thanks

  7. #7
    Sencha User joshmorony's Avatar
    Join Date
    Jan 2014
    Posts
    48
    Vote Rating
    4
    joshmorony is on a distinguished road

      1  

    Default


    I'm not sure what issues you're having with the script being included during the build, but I do have a solution for you to try. I always dynamically include the Google Maps script by listening for whether the device has an Internet connection or not. If it does the script is injected, if it doesn't then the app waits until a connection is available and then injects the script.

    This avoids errors with google being undefined if there is no connection when the user starts the app. It should also circumvent the issues you're having. I have a summary of how to do it on my blog: http://www.joshmorony.com/dynamicall...-availability/

  8. #8
    Sencha User
    Join Date
    Feb 2013
    Posts
    34
    Vote Rating
    2
    Keab42 is on a distinguished road

      0  

    Default


    Quote Originally Posted by joshmorony View Post
    I'm not sure what issues you're having with the script being included during the build, but I do have a solution for you to try. I always dynamically include the Google Maps script by listening for whether the device has an Internet connection or not. If it does the script is injected, if it doesn't then the app waits until a connection is available and then injects the script.

    This avoids errors with google being undefined if there is no connection when the user starts the app. It should also circumvent the issues you're having. I have a summary of how to do it on my blog: http://www.joshmorony.com/dynamicall...-availability/
    Thank you for this. I've been smashing my head against a brick wall trying to figure out the best way to handle the Google Maps on/offline problem. A really elegant solution.