Google Maps compatibility IE11 not working because of polyfills.js

后端 未结 2 2100
悲&欢浪女
悲&欢浪女 2021-02-10 01:51

My app website is not working fine on IE11.

The website is not loading, it gives me a blank page

This is the error thrown on IE11 :

SCRIPT5005:          


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-10 02:52

    You could add the Google Maps script to the ngOnInit() method instead of in the tag.

    let googleMapsScript = document.createElement('script')
    googleMapsScript.setAttribute('src', 'https://maps.google.com/maps/api/js?v=3.38&key=YOURGOOGLEMAPSAPIKEY&libraries=places')
    document.head.appendChild(googleMapsScript)
    

    This will load the Google Maps script after the main JS for the application is loaded. I don't use Angular but a similar approach works well in VueJS.

提交回复
热议问题