diff options
author | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-10-11 17:14:18 +0200 |
---|---|---|
committer | TrueKuehli <rctcoaster2000@hotmail.de> | 2018-10-11 17:14:18 +0200 |
commit | 852474350bdd708344857488543fc8b912977a89 (patch) | |
tree | bc054a188646eda4413dce7cbb68d5d954d3a52e /WebInterface/NodeJSServer/src/modules | |
parent | ced351c238a5d6734343553ae36ad36246a23598 (diff) |
Redirect doesn't change head anymore
Now uses body.innerHTML for replacing content.
-> In light of document.write being one of the main target for Google's attempts at making the Chrome Browser more performant
-> Additionally this may or may not fix an issue
Diffstat (limited to 'WebInterface/NodeJSServer/src/modules')
-rw-r--r-- | WebInterface/NodeJSServer/src/modules/ui/login-modal.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/WebInterface/NodeJSServer/src/modules/ui/login-modal.js b/WebInterface/NodeJSServer/src/modules/ui/login-modal.js index 0bfd70d..13de78e 100644 --- a/WebInterface/NodeJSServer/src/modules/ui/login-modal.js +++ b/WebInterface/NodeJSServer/src/modules/ui/login-modal.js @@ -152,14 +152,19 @@ export default class LoginModal extends Modal { 'play#game=' + this.serverName); fetch('play').then((response) => { response.text().then((htmlString) => { + // Replace all references, since we're starting one level farther up htmlString = htmlString.replace(/\.\.\//g, './'); + htmlString = /<body>((.)|(\n))*<\/body>/g.exec(htmlString)[0]; htmlString = htmlString.replace(/<script src=".*"><\/script>/, ''); - console.log(htmlString); htmlString = htmlString.replace( /<remove_if_redirected>((.)|\n)*?<\/remove_if_redirected>/g, ''); - document.open(); - document.write(htmlString); - document.close(); + document.body.innerHTML = htmlString; + + let stylesheet = document.createElement('link'); + stylesheet.rel = 'stylesheet'; + stylesheet.type = 'text/css'; + stylesheet.href = './style/play.css'; + document.head.appendChild(stylesheet); for (let ui of this.pageUI) { ui.refresh(); |