Search code examples
angularjsxmlhttprequestoverridingbing-maps

Why Bing Maps v8 override XMLHttpRequest send function?


I'm working on an AngularJS application that use Bing Maps components.

Since a few weeks I'm using the new Bing V8 version.

I am little bit scared to see that the initiator of all my http request is' mapcontrol? SetLang = ... '

So, After a quick look I notice that Bing Maps v8 accessible by this link was overriding the XMLHttpRequest send function and I was wondering why?

And also, Is it possible to prevent it?

Thank you in advance.


Solution

  • It only overrides it if it has already been overridden and the modified version was causing a breaking change. We noticed that some JavaScript frameworks override the XMLHttpRequest class. What Bing Maps V8 does is detect if it has been overridden, and if it has, makes a copy internally and overwrites some of the functions in that copy with the standard code it should have. This only affects the internal map requests and make no changes to any of your requests using the XMLHttpRequest class outside of the map control.