From 041f1c559c1ec95deddc5b3603e6ffaae90ce06b Mon Sep 17 00:00:00 2001 From: Victor Bjelkholm Date: Sat, 19 Sep 2015 22:29:07 +0200 Subject: [PATCH] Correctly detect browser vs node environment --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index c8fb53517..07681208e 100644 --- a/src/index.js +++ b/src/index.js @@ -22,7 +22,7 @@ function IpfsAPI (host_or_multiaddr, port) { // autoconfigure in browser if (!config.host && - window && window.location) { + typeof window !== 'undefined') { var split = window.location.host.split(':') config.host = split[0] config.port = split[1]