简体   繁体   中英

Angular 6 website not working on IE but works locally on all browsers

  • Angular 6 website
  • VMware virtual machine environment
  • Windows Server 2012 R2 Standard server

I have an angular website working fine in chrome browser (all versions) on my laptop

  • Same angular website works fine in IE in my laptop (all versions) in my laptop
  • But when i deploy this in client server, virtual machine, chrome website works fine
  • But IE website give white blank page for all versions (all VMs in the data center)
  • There is no errors in console nor warnings
  • relevant polyfills.ts lines are uncommented

I changed the mode of IE to compatibility and observed following errors in console:

SCRIPT5009: 'Promise' is undefined
jspdf.min.js (118,654)
SCRIPT1002: Syntax error
main.js (8527,59)
SCRIPT5011: Can't execute code from a freed script
zone.js (2775,1)

To get Angular App working on IE, go to polyfills.ts and uncomment the following

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
 import 'core-js/es6/symbol';
 import 'core-js/es6/object';
 import 'core-js/es6/function';
 import 'core-js/es6/parse-int';
 import 'core-js/es6/parse-float';
 import 'core-js/es6/number';
 import 'core-js/es6/math';
 import 'core-js/es6/string';
 import 'core-js/es6/date';
 import 'core-js/es6/array';
 import 'core-js/es6/regexp';
 import 'core-js/es6/map';
 import 'core-js/es6/weak-map';
 import 'core-js/es6/set';

This is a known bug relating to zone.js and the IE Developer Tools. https://github.com/angular/angular/issues/31723

The development workaround is to add this flag before loading zone.js

(window as any).__Zone_enable_cross_context_check = true;
import 'zone.js/dist/zone';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM