If a user chooses to not accept cookies, which in Safari also disables local storage, a Meteor website doesn’t work and shows a not very helpful message. Is there any way for Meteor to show a better error or instructions?
That’s Iron Router which is showing that message. Normal Meteor shows nothing at all
So just go fork Iron Router!
Or you could check yourself if cookies are blocked and show a message. Maybe in a separate script that you put in <head>
so that it will still run if Meteor crashes.
It would be nice if Meteor didn’t just crash without any message when local storage is blocked though…
True that - it would be nice if it could consider all situations, like JavaScript being disabled, cookies not working, or a browser being unsupported.
I actually need to correct my report of Meteor not working. It does work with the mentioned paranoid security settings (there are error messages, but the site continues).
The reason I was seeing the error was that I used localStorage directly, which failed and crashed my site before the routes could be defined.
I now simply inform the user that the browser security settings are a bit paranoid, something like this
WebApp.hasLocalstorage = (function(){
var test = 'test';
try {
localStorage.setItem(test, test);
localStorage.removeItem(test);
return true;
} catch(e) {
return false;
}
})();
Meteor.startup(function(){
if(!WebApp.hasLocalstorage) {
alert('You are too paranoid! Please change the security settings of your browser to allow local storage');
}
});