Test that localStorage works before uses it

Fixes accounts-password login with private-browsing Safari, and probably
some IE configurations too.

Fixes #1291 (I hope, not tested on IE). Similar to #1688.

This still means that multi-tab won't work with private browsing, unfortunately.