diff --git a/src/vector/index.ts b/src/vector/index.ts index c820587386..a8f1538fc0 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 ea8ef92084..0000000000 --- a/src/vector/mobile_guide/index--invalid-config.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - -
- -
- -
-
- -

Invalid config

-
-
-
-
-

This Riot is misconfigured

-

Something something... contact your server admin.

-
-
-
-
-

- - Go to Riot.im - -

-
-
- - diff --git a/src/vector/mobile_guide/index--unable-to-load.html b/src/vector/mobile_guide/index--unable-to-load.html deleted file mode 100644 index fda95b9597..0000000000 --- a/src/vector/mobile_guide/index--unable-to-load.html +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - - - - - - -
- -
- -
-
- -

Unable to load

-
-
-
-
-

Riot can't load

-

Something something... contact your server admin.

-
-
-
-
-

- - Go to Riot.im - -

-
-
- - diff --git a/src/vector/incompatible_browser/index.html b/src/vector/static/incompatible-browser.html similarity index 99% rename from src/vector/incompatible_browser/index.html rename to src/vector/static/incompatible-browser.html index f7a63518b2..edd642015c 100644 --- a/src/vector/incompatible_browser/index.html +++ b/src/vector/static/incompatible-browser.html @@ -8,6 +8,10 @@ display: none; } + html { + height: 100%; + } + body { background: #c5e0f7; background: -moz-linear-gradient(top, #c5e0f7 0%, #ffffff 100%); @@ -165,8 +169,8 @@

Use Riot in a browser

-

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.

diff --git a/src/vector/static/unable-to-load.html b/src/vector/static/unable-to-load.html new file mode 100644 index 0000000000..f521965316 --- /dev/null +++ b/src/vector/static/unable-to-load.html @@ -0,0 +1,199 @@ + + + + + + + + + + + +
+ +
+ +
+
+ +

Unable to load

+
+
+
+
+

Riot can't load

+

Something went wrong and riot was unable to load.

+
+
+
+
+

+ + Go to Riot.im + +

+
+
+ + diff --git a/webpack.config.js b/webpack.config.js index 5bde203ea4..9c6d099396 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -335,6 +335,20 @@ module.exports = (env, argv) => { chunks: ['mobileguide'], }), + // These are the static error pages for when the javascript env is *really unsupported* + new HtmlWebpackPlugin({ + template: './src/vector/static/unable-to-load.html', + filename: 'static/unable-to-load.html', + minify: argv.mode === 'production', + chunks: [], + }), + new HtmlWebpackPlugin({ + template: './src/vector/static/incompatible-browser.html', + filename: 'static/incompatible-browser.html', + minify: argv.mode === 'production', + chunks: [], + }), + // This is the usercontent sandbox's entry point (separate for iframing) new HtmlWebpackPlugin({ template: './node_modules/matrix-react-sdk/src/usercontent/index.html',