From b7fa8a1f54c74bc237ea15678abc49ae2d133bbb Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 23 Apr 2020 13:37:25 +0100 Subject: [PATCH] wire up the static fallback error pages Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/vector/index.ts | 18 +- .../mobile_guide/index--invalid-config.html | 185 ---------------- .../mobile_guide/index--unable-to-load.html | 185 ---------------- .../incompatible-browser.html} | 8 +- src/vector/static/unable-to-load.html | 199 ++++++++++++++++++ webpack.config.js | 14 ++ 6 files changed, 234 insertions(+), 375 deletions(-) delete mode 100644 src/vector/mobile_guide/index--invalid-config.html delete mode 100644 src/vector/mobile_guide/index--unable-to-load.html rename src/vector/{incompatible_browser/index.html => static/incompatible-browser.html} (99%) create mode 100644 src/vector/static/unable-to-load.html diff --git a/src/vector/index.ts b/src/vector/index.ts index c8205873..a8f1538f 100644 --- a/src/vector/index.ts +++ b/src/vector/index.ts @@ -199,9 +199,21 @@ async function start() { ]); } } + start().catch(err => { console.error(err); - if (!acceptBrowser) { - // TODO redirect to static incompatible browser page - } + // show the static error in an iframe to not lose any context / console data + // with some basic styling to make the iframe full page + delete document.body.style.height; + const iframe = document.createElement("iframe"); + iframe.src = acceptBrowser ? "static/unable-to-load.html" : "static/incompatible-browser.html"; + iframe.style.width = "100%"; + iframe.style.height = "100%"; + iframe.style.position = "absolute"; + iframe.style.top = "0"; + iframe.style.left = "0"; + iframe.style.right = "0"; + iframe.style.bottom = "0"; + iframe.style.border = "0"; + document.getElementById("matrixchat").appendChild(iframe); }); diff --git a/src/vector/mobile_guide/index--invalid-config.html b/src/vector/mobile_guide/index--invalid-config.html deleted file mode 100644 index ea8ef920..00000000 --- a/src/vector/mobile_guide/index--invalid-config.html +++ /dev/null @@ -1,185 +0,0 @@ - - -
- - - - - - - - - -Something something... contact your server admin.
-Something something... contact your server admin.
-It looks like you're using an unsupported browser. To use Riot on the web, please use Chrome, Safari, - FireFox or Edge.
+It looks like you're using an unsupported browser. + To use Riot on the web, please use a modern version ofChrome, Safari, or Firefox.
Something went wrong and riot was unable to load.
+