Skip to content

Commit

Permalink
Client, polyfills: check for sessionStorage using a more cross-browse…
Browse files Browse the repository at this point in the history
…r (apparently) way
  • Loading branch information
carlfeberhard committed Dec 9, 2015
1 parent d41ea8d commit d72dd37
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/base-mvc.js
Expand Up @@ -66,7 +66,7 @@ var SessionStorageModel = Backbone.Model.extend({

_checkEnabledSessionStorage : function(){
try {
return sessionStorage.length;
return window.sessionStorage.length >= 0;
} catch( err ){
alert( 'Please enable cookies in your browser for this Galaxy site' );
return false;
Expand Down
8 changes: 4 additions & 4 deletions client/galaxy/scripts/polyfills.js
Expand Up @@ -51,25 +51,25 @@
};

// ------------------------------------------------------------------ can't/won't polyfill
var incompatibilities = [
var features = [
{ name: 'canvas', compatible: function(){ return window.CanvasRenderingContext2D; } },
{ name: 'sessionStorage', compatible: function(){
try {
return Number.isInteger( sessionStorage.length );
return window.sessionStorage.length >= 0;
} catch( err ){}
return false;
}},
];
// build a list of feature names for features that were not found
incompatibilities = incompatibilities
var incompatibilities = features
.filter( function( feature ){ return !feature.compatible(); })
.map( function( feature ){ return feature.name; });

// if there are needed features missing, follow the index link to the static incompat warning
if( !!incompatibilities.length ){
var root = document.querySelectorAll( 'link[rel="index"]' ).item( 0 );
if( root ){
window.location.href = root.href + 'static/incompatible-browser.html';
window.location = root.href + 'static/incompatible-browser.html';
}
console.log( 'incompatible browser:\n' + incompatibilities.join( '\n' ) );
}
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/base-mvc.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/maps/polyfills.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions static/scripts/bundled/libs.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

0 comments on commit d72dd37

Please sign in to comment.