diff --git a/primus.js b/primus.js
index <HASH>..<HASH> 100644
--- a/primus.js
+++ b/primus.js
@@ -41,7 +41,7 @@ try {
   if (location.origin) {
     defaultUrl = location.origin;
   } else {
-    defaultUrl = location.protocol +'//'+ location.hostname + (location.port ? ':'+ location.port : '');
+    defaultUrl = location.protocol +'//'+ location.host;
   }
 } catch (e) {
   defaultUrl = 'http://127.0.0.1';
[minor] Use location.host instead of location.hostname and location.port