none
Bing Maps V8 won't loadModule() in IE10 when Browser Cache is active RRS feed

  • Question

  • Hello,

    first up: I know that Bing Maps v8 does not officially support IE10, however what we are trying seems to work well, as long as the browser cache is deactivated. So I am hoping that there might be someone who knows a fix for our problem, or a statement why this is behaving like that.

    What we do:

    - load Bing Maps API

    - when loaded, load GeoJson module

    - display Pushpins or Polygons from our GeoJson data

    It all works fine if we have the IE10 DevTools open and "Always refresh from server" checked. Maps API loads and triggers the loadModule() call, which loads fine and the map displays our data.

    But if we uncheck that option, so that IE10 uses its cache (that's what we suppose it does then...), the call to loadModule() will throw an Error:

    SCRIPT5007: Unable to get property 'prototype' of undefined or null reference 
    mapcontrol, line 12 character 7075

    We made sure the API is loaded, also the loadModule() function exists. It must be something that happens after the module was loaded, or while loading it.

    Here's the code we use:

    this.mapsApiReady = this.deferred();
    
    loadMapsApi(){
        this.loadMapScript()
            .then(()=>{
                this.log("loadMapScript.then");
                return this.loadMapModule();
            })
            .then(()=>{
                this.log("loadMapModule.then");
                this.mapsApiReady.resolve(this.mapsApi);
            })
        ;
    }
    
    loadMapScript(){
        return loadBingMap().then((mapsApi)=>{
            this.log("loadBingMap.then");
            if(mapsApi){
                this.mapsApi = window.Microsoft.Maps;
            } else {
                this.mapsApiReady.reject();
            }
        });
    }
    
    loadBingMaps(){
        const promise = this.deferred();
        const callbackId = `callback-${this.getID()}`;
    
        // resolve immediately if the maps API were loaded before
        if(window.Microsoft && window.Microsoft.Maps){
            return promise.resolve(window.Microsoft.Maps);
        }
    
        // create a temporary global callback for the maps script to call after finishing loading and init
        window[callbackId] = ()=>{
            if(window[callbackId]){
                delete window[callbackId];
            }
            promise.resolve(window.Microsoft.Maps);
        };
    
        // load the script
        this.loadScript(`//www.bing.com/api/maps/mapcontrol?branch=release&callback=${callbackId}`);
    
        return promise;
    }
    
    loadMapModule(){
        this.log("loadModule");
        const modulePromise = this.deferred();
                
        this.mapsApi.loadModule('Microsoft.Maps.GeoJson', ()=>{
              this.log("loaded module");
              modulePromise.resolve();
            });
          }
        });
    
        return modulePromise ;
    }

    And here the logs when it fails:

    loadBingMap.then 
    loadMapScript.then 
    loadModule
    SCRIPT5007: Unable to get property 'prototype' of undefined or null reference 
    mapcontrol, line 12 character 7075

    Any feedback is much appreciated!


    • Edited by Hendrik Apel Thursday, January 12, 2017 2:16 PM char escape
    Thursday, January 12, 2017 2:16 PM

Answers

  • This is a known bug that is marked low priority since IE10 isn't officially supported and currently does not have a timeline for being resolved. However, I am aiming to have the team to resolve this before the end of June.

    [Blog] [twitter] [LinkedIn]


    Friday, January 13, 2017 9:06 PM

All replies