diff options
author | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2011-07-05 20:16:45 +0200 |
---|---|---|
committer | Peter 'Pita' Martischka <petermartischka@googlemail.com> | 2011-07-05 20:16:45 +0200 |
commit | 973d73ebee77fba60e8ca6baa85c55afbf5ace15 (patch) | |
tree | 42a11b5eb8df4829e80583320ba76e4a98a49327 /static/js/pad2.js | |
parent | ee2c8f4524329dd766a1fb19c72eb145cb0e921d (diff) | |
download | etherpad-lite-973d73ebee77fba60e8ca6baa85c55afbf5ace15.zip |
ensure all paths are relative
Diffstat (limited to 'static/js/pad2.js')
-rw-r--r-- | static/js/pad2.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/static/js/pad2.js b/static/js/pad2.js index e359b044..24aa182b 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -60,7 +60,16 @@ function randomString() { function handshake() { - socket = io.connect(); + var loc = document.location; + //get the correct port + var port = loc.port == "" ? (loc.protocol == "https:" ? 443 : 80) : loc.port; + //create the url + var url = loc.protocol + "//" + loc.hostname + ":" + port + "/"; + //find out in which subfolder we are + var resource = loc.pathname.substring(0,loc.pathname.indexOf("/p/")) + "/socket.io"; + + //connect + socket = io.connect(url, {resource: resource}); socket.on('connect', function(){ var padId= document.URL.substring(document.URL.lastIndexOf("/")+1); |