Add error page for no support.

This commit is contained in:
kovacsv 2014-10-11 15:18:52 +02:00
parent 5ad2bcb17e
commit 63e3f4822d
3 changed files with 58 additions and 0 deletions

View File

@ -10,6 +10,17 @@ html, body
height : 100%;
}
#nosupport
{
padding : 10px;
}
#nosupport div.title
{
font-size : 17px;
margin-bottom : 10px;
}
#top
{
color : #dddddd;

View File

@ -8,6 +8,49 @@ ImporterApp = function ()
ImporterApp.prototype.Init = function ()
{
function CheckSupport ()
{
if (!window.WebGLRenderingContext) {
return false;
}
if (!window.File || !window.FileReader || !window.FileList || !window.Blob) {
return false;
}
try {
var canvas = document.createElement ('canvas');
if (!canvas.getContext ('experimental-webgl') && !canvas.getContext ('webgl')) {
return false;
}
} catch (exception) {
return false;
}
return true;
}
if (!CheckSupport ()) {
var i, child;
var children = [];
for (i = 0; i < document.body.children.length; i++) {
child = document.body.children[i];
children.push (child);
}
for (i = 0; i < children.length; i++) {
child = children[i];
if (child.id == 'nosupport') {
child.style.display = '';
} else {
document.body.removeChild (child);
}
}
return;
}
var myThis = this;
var top = document.getElementById ('top');
var importerButtons = new ImporterButtons (top);

View File

@ -29,6 +29,10 @@
</div>
<canvas id="example" width="0" height="0"></canvas>
<input type="file" id="file" style="display:none" multiple></input>
<div id="nosupport" style="display:none">
<div class="title">Unfortunately your browser not supports this site.</div>
You need a browser which supports the following: WebGL, WebGLRenderingContext, File, FileReader, FileList, Blob.
</div>
</body>
</html>