devote / HTML5-History-API

HTML5 History API expansion for browsers not supporting pushState, replaceState
http://spb-piksel.ru
MIT License
1.02k stars 182 forks source link

sessionStorage throws error when cookies are disabled #34

Closed ThaNarie closed 11 years ago

ThaNarie commented 11 years ago

// this line var sessionStorage = window['sessionStorage'];

Causes errors when, for whatever reason, cookies are disabled. This can be because of 'disable cookies' in a development-plugin, or the 'Block third-party cookies and site data' in the Chrome content settings when running the site in a Facebook IFrame.

Calls to window['sessionStorage'] should be wrapped in a try-catch.

devote commented 11 years ago

Thank you for help!

simenbrekken commented 10 years ago

This doesn't seem to be enough for Safari Mobile which reports window['sessionStorage'] as true even if in Private Browsing mode. The only solution I've come across so far is attempting to set and get an item.

Details here: http://stackoverflow.com/a/12976988/669360