diff --git a/examples/control.html b/examples/control.html index f9a97d4..cc45bfa 100644 --- a/examples/control.html +++ b/examples/control.html @@ -71,23 +71,30 @@ var roomID = "undefined"; - if (urlParams.has("room")){ - roomID = urlParams.get("room"); - } else { - roomID = generateStreamID(); - updateURL("room="+roomID); - } - - var url = document.URL.substr(0,document.URL.lastIndexOf('/')); - - - navigator.clipboard.writeText(url+"/mixer?room="+roomID).then(() => { - /* clipboard successfully set */ - }, () => { - /* clipboard write failed */ - }); - - document.getElementById("body").innerHTML+=url+"/mixer?room="+roomID; + if (urlParams.has("room")){ + roomID = urlParams.get("room"); + } else { + roomID = generateStreamID(); + updateURL("room="+roomID); + } + + var url = document.URL.substr(0,document.URL.lastIndexOf('/')); + var mixerURL = url + "/mixer?room=" + encodeURIComponent(roomID); + var bodyElement = document.getElementById("body"); + var linkWrapper = document.createElement("div"); + var mixerLink = document.createElement("a"); + mixerLink.href = mixerURL; + mixerLink.textContent = mixerURL; + linkWrapper.appendChild(mixerLink); + + + navigator.clipboard.writeText(mixerURL).then(() => { + /* clipboard successfully set */ + }, () => { + /* clipboard write failed */ + }); + + bodyElement.appendChild(linkWrapper); var socket = new WebSocket("wss://api.action.wtf:666"); // api.action.wtf has been deprecated. @@ -120,4 +127,4 @@ - \ No newline at end of file +