Skip to content

Commit

Permalink
Merge pull request #103 from everdimension/fix_dom_exception
Browse files Browse the repository at this point in the history
fix DOM Exception 18 when cookies are blocked by user in Safari
  • Loading branch information
egilkh committed Jun 19, 2015
2 parents 9d08278 + a56382a commit 53eb47a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ngStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,16 @@
$timeout
){
function isStorageSupported(storageType) {
var supported = $window[storageType];

// fix 'SecurityError: DOM Exception 18' exception in Desktop Safari, Mobile Safari
// when "Block cookies": "Always block" is turned on
var supported;
try {
supported = $window[storageType];
}
catch (err) {
supported = false;
}

// When Safari (OS X or iOS) is in private browsing mode, it appears as though localStorage
// is available, but trying to call .setItem throws an exception below:
Expand Down

0 comments on commit 53eb47a

Please sign in to comment.