Skip to content

Commit 36888c2

Browse files
committed
Merge pull request #452 from mrbar42/patch-1
added fallback to insertAt parentNode
2 parents 8824c2e + 5564855 commit 36888c2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/transports/polling-jsonp.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,12 @@ JSONPPolling.prototype.doPoll = function () {
132132
};
133133

134134
var insertAt = document.getElementsByTagName('script')[0];
135-
insertAt.parentNode.insertBefore(script, insertAt);
135+
if (insertAt) {
136+
insertAt.parentNode.insertBefore(script, insertAt);
137+
}
138+
else {
139+
(document.head || document.body).appendChild(script);
140+
}
136141
this.script = script;
137142

138143
var isUAgecko = 'undefined' != typeof navigator && /gecko/i.test(navigator.userAgent);

0 commit comments

Comments
 (0)