fix localStorage detection in iOS privacy mode

iOS disables localStorage in privacy mode, but the object is still on the window. That's why the previous test resulted in an error.
I've replaced it with the test from Modernizr.