Only push to history with present page URL plus room name

Use location.href instead of location.pathname to make the URL absolute
This commit is contained in:
Aaron van Meerten 2016-06-03 13:00:09 -05:00
parent 0fec9565e5
commit c2eede2bb5
1 changed files with 3 additions and 8 deletions

11
app.js
View File

@ -51,14 +51,9 @@ function buildRoomName () {
if(!roomName) {
let word = RoomnameGenerator.generateRoomWithoutSeparator();
roomName = word.toLowerCase();
let historyURL = window.location.pathname + word;
//Trying to push state with URL "/" + roomName
var err = pushHistoryState(word, historyURL);
//If URL "/" + roomName is not good, trying with explicitly adding the
//domain name.
if(err && config.hosts.domain) {
pushHistoryState(word, "//" + config.hosts.domain + historyURL);
}
let historyURL = window.location.href + word;
//Trying to push state with current URL + roomName
pushHistoryState(word, historyURL);
}
return roomName;