Created
October 2, 2013 08:04
-
-
Save xyqfer/6790449 to your computer and use it in GitHub Desktop.
检测 storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tests['localstorage'] = function() { | |
try { | |
localStorage.setItem(mod, mod); | |
localStorage.removeItem(mod); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
}; | |
tests['sessionstorage'] = function() { | |
try { | |
sessionStorage.setItem(mod, mod); | |
sessionStorage.removeItem(mod); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment