mirror of
https://github.com/debug-js/debug.git
synced 2025-12-08 20:59:48 +00:00
Mobile Safari (private mode) is broken with debug
Mobile Safari has a dumb feature where it goes ahead and throws an exception when trying to access the localStorage in private mode. Other people with the same issue: http://meta.stackoverflow.com/questions/123116/safari-5-1-2-log-in-doesnt-work Simply wrapping the local storage access in a try/catch should do the trick...
This commit is contained in:
parent
73936c4ddf
commit
83aaaac519
6
debug.js
6
debug.js
@ -50,7 +50,9 @@ debug.skips = [];
|
||||
*/
|
||||
|
||||
debug.enable = function(name) {
|
||||
localStorage.debug = name;
|
||||
try {
|
||||
localStorage.debug = name;
|
||||
} catch(e){}
|
||||
|
||||
var split = (name || '').split(/[\s,]+/)
|
||||
, len = split.length;
|
||||
@ -119,4 +121,4 @@ debug.enabled = function(name) {
|
||||
|
||||
// persist
|
||||
|
||||
if (window.localStorage) debug.enable(localStorage.debug);
|
||||
if (window.localStorage) debug.enable(localStorage.debug);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user