question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JSONP call fails in Internet Explorer 11 and Google Maps API

See original GitHub issue

🐞 bug report

Affected Package

The issue is caused by package @angular/common.

And it is related to @angular/google-maps.

Is this a regression?

I’m not sure. This is the first time for me trying to implement a JSONP call to the Google Maps API in Angular and support Internet Explorer 11.

Description

A JSONP call to the Google Maps API fails in Internet Explorer 11 while it works fine in other browsers.

I followed this guide: https://github.com/angular/components/tree/master/src/google-maps#lazy-loading-the-api

JSONP calls only fail in Internet Explorer with the Google Maps API. I tried other JSONP endpoints, and they seem to work fine. So, if you think this is not an Angular issue, this bug needs to taken to the Google Maps API I guess.

🔬 Minimal Reproduction

I created a demo repository here: https://github.com/sebastianhaeni/angular-jsonp-bug

Unfortunately it cannot be reproduced on stackblitz because it needs a full prod build, so IE 11 can execute the JavaScript (ES5 and polyfills needed).

My hunch is that it’s somehow a problem with the lifecycle of the JSONP callback function on the window object, which is maybe removed too early.

🔥 Exception or Error


Unhandled Promise rejection: ng_jsonp_callback_0 is not a function ; Zone: <root> ; Task: Promise.then ; Value: InvalidValueError: ng_jsonp_callback_0 is not a function undefined

🌍 Your Environment

Angular Version:


Angular CLI: 10.0.8
Node: 12.18.1
OS: darwin x64

Angular: 10.0.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.8
@angular-devkit/build-angular     0.1000.8
@angular-devkit/build-optimizer   0.1000.8
@angular-devkit/build-webpack     0.1000.8
@angular-devkit/core              10.0.8
@angular-devkit/schematics        10.0.8
@angular/cli                      10.0.8
@ngtools/webpack                  10.0.8
@schematics/angular               10.0.8
@schematics/update                0.1000.8
rxjs                              6.5.5
typescript                        3.9.7
webpack                           4.43.0

Anything else relevant?

Specific browser version:

  • Internet Explorer 11
  • Version: 11.3986.14393.0
  • Update Versions: 11.0.210

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JiaLiPassioncommented, Oct 31, 2020

@sebastianhaeni, I just debug the case, and in IE11, Angular is using core-js promise as polyfill, and the microTask scheduler is MutationObserver not setTimeout, but your analysis is correct.

  1. in IE11, the script onload event is fired before Promise.then.
  2. in modern browsers, the script onload event is fired after Promise.then since they are using native promise.then as scheduler.

So I would suggest not using setTimeout, you can try using Promise.resolve().then() in onload event handler to delay the onload execution.

0reactions
angular-automatic-lock-bot[bot]commented, Dec 19, 2020

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jsonp callback in internet explorer not working - Stack Overflow
I am using JSONP to gather data from an API with AJAX. I have tested my code in firefox and chrome and it...
Read more >
Maps JavaScript API Release Notes - Google Developers
Internet Explorer 11 is now decommissioned in the Maps Embed API. The Google logo in the Maps Embed API changes style when using...
Read more >
I am getting an error in IE11 - The Google Maps JavaScript ...
I am getting an error in IE11 - The Google Maps JavaScript API does not support this browser. So my map display is...
Read more >
Google Maps Not Working in Internet Explorer (IE) - Ben Nadel
I am working on a page where I have a google-powered map (just like the one you find on maps.google.com. It works just...
Read more >
Known Exploited Vulnerabilities Catalog | CISA
The vulnerability is due to insufficient queue management for Internet Group ... Chrome, Google Chrome Browser V8 Arbitrary Code Execution, 2021-11-03 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found