From 832baa0eaf18af53e2ae121cdca8333d4e71ef8e Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Wed, 14 Sep 2016 14:28:57 -0700 Subject: [PATCH] fix(fetch): correct chrome not able to load about://blank Closes #444 --- lib/zone.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/zone.ts b/lib/zone.ts index 534516310..f8b6c92d1 100644 --- a/lib/zone.ts +++ b/lib/zone.ts @@ -1145,7 +1145,14 @@ const Zone: ZoneType = (function(global: any) { if (NativePromise) { patchThen(NativePromise); if (typeof global['fetch'] !== 'undefined') { - const fetchPromise = global['fetch']('about:blank'); + var fetchPromise: Promise; + try { + // In MS Edge this throws + fetchPromise = global['fetch'](); + } catch (e) { + // In Chrome this throws instead. + fetchPromise = global['fetch']('about:blank'); + } // ignore output to prevent error; fetchPromise.then(() => null, () => null); if (fetchPromise.constructor != NativePromise) {