diff --git a/src/index.js b/src/index.js index 3e2a9001..94095954 100644 --- a/src/index.js +++ b/src/index.js @@ -379,6 +379,18 @@ class MiniCssExtractPlugin { : '', 'var head = document.getElementsByTagName("head")[0];', 'head.appendChild(linkTag);', + "// old webkit's would claim to have onload, but didn't really support it", + '// https://github.com/kriszyp/xstyle/blob/master/core/load-css.js', + 'var webkitVersion = navigator.userAgent.match(/AppleWebKit\\/(\\d+\\.?\\d*)/);', + 'webkitVersion = webkitVersion && +webkitVersion[1];', + 'if (webkitVersion < 536) {', + Template.indent([ + '// http://www.backalleycoder.com/2011/03/20/link-tag-css-stylesheet-load-event/', + 'var img = document.createElement("img");', + 'img.onerror = resolve;', + `img.src = fullhref;`, + ]), + '}', ]), '}).then(function() {', Template.indent(['installedCssChunks[chunkId] = 0;']),