Update host.js

window can be defined and yet window.location can be undefined: both "window" and  "window.location" must be defined to access to "protocol" information
This commit is contained in:
damienleroux
2016-01-20 11:42:39 +01:00
parent 1544ef84c3
commit 4e152d8b7d

View File

@ -12,7 +12,7 @@ var startsWithProtocolRE = /^([a-z]+:)?\/\//;
var defaultProto = 'http:';
var btoa;
if (typeof window !== 'undefined') {
if (typeof window !== 'undefined' && typeof window.location !== 'undefined') {
defaultProto = window.location.protocol;
btoa = window.btoa;
}