5

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: String expected
js (26,286)

SCRIPT5022: Exception thrown and not caught.
polyfills.js (3234,3)

I'm enclosing the screen capture on on the console

enter image description here

I have included the API in my index.html like this :

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>

It should include googlemaps after my polyfills.js, but I'm not sure on how to do that

I've tried to use agm-map, and others solutions but so far, nothing is working.

Andy K
  • 4,944
  • 10
  • 53
  • 82
  • Can you provide a [mcve] that demonstrates the issue? – geocodezip Jul 24 '19 at 01:06
  • Please try the solutions in https://stackoverflow.com/questions/45353619/angular4-application-running-issues-in-ie11 and let us know if they worked for you. – evan Jul 25 '19 at 12:04
  • @evan It didn't worked (it was already uncomment) – Vincent 'On-arap' Burel Jul 26 '19 at 08:26
  • I see, thanks for your update. Have you also installed the packages? (https://blog.angularindepth.com/angular-and-internet-explorer-5e59bb6fb4e9) Are you using both es6 and es7? Ran npm install? Also please double check that all required polyfills are uncommented, and update your project's packages. Also try other solutions in https://stackoverflow.com/questions/35140718/angular-2-4-5-not-working-in-ie11 and let me know if anything works. – evan Jul 26 '19 at 11:12
  • Hi @evan my colleague did all that was said e.g commented the install and install the packages but no luck, it did not help. – Andy K Aug 21 '19 at 14:19
  • Hi Andy, thanks for your update. Okay so can you share a reproducible code example? In e.g. codesandbox.io? I'll need to do some testing on my end to be able to help if the known solutions I've linked aren't working in your case. – evan Aug 21 '19 at 14:36
  • @evan my colleague is working on that. He will put an update on it. Thank you. – Andy K Aug 21 '19 at 15:39
  • Sounds good! Please keep me posted :) – evan Aug 21 '19 at 16:21

2 Answers2

6

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.

2

I had the same issue. Not Angular but same issue.

I changed the following:

<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places,geometry"></script>

to

<script async defer src="https://maps.googleapis.com/maps/api/js?key=API_KEY&libraries=places,geometry"></script>

Steve
  • 121
  • 1
  • 2