I happened to run with the same issue in iOS 7 (with some devices no simulators).
Looks like Safari in iOS 7 has a lower storage quota, which apparently is reached by having a long history log.
I guess the best practice will be to catch the exception.
The Modernizr project has an easy patch, you should try something similar: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/storage/localstorage.js