0

Currently, we have a WebApp which uses sessionStorage for storing values when navigating from pages. This seems to work fine on other IE, Chrome, Firefox, and Safari. But when using Private mode in Safari, it seems it is causing an error. It messed the UI showing variables we used for PUG. (ie. {{title}}, {{description}}. I think the problem is that it is throwing an error on saving the SessionStorage. Is there any workaround we can use for this one?

Below is the code for the method on LS:

app.factory("LS", function($window, $rootScope) {
  return {
    setData: function(key, val) {
      $window.sessionStorage && $window.sessionStorage.setItem(key, val);
      return this;
    },
    getData: function(val) {
      return $window.sessionStorage && $window.sessionStorage.getItem(val);
    }
  };
});
banri16
  • 247
  • 1
  • 6
  • 16
  • use "ngstorage" or anyother plugin for storing data on local machine. – ziaulain Jun 29 '17 at 08:02
  • Thanks for the quick response. Will this work for Safari Private mode? The error I am getting on safari is "QuotaExceededError: DOM Exception 22" – banri16 Jun 29 '17 at 08:14
  • i dont think so.. – ziaulain Jun 29 '17 at 08:48
  • Is there another workaround we can use for us to implement session storage on private browsing that you can suggest? – banri16 Jun 29 '17 at 09:10
  • private mode is built to provide privacy to a user. – ziaulain Jun 29 '17 at 09:13
  • yes, I know that. But I think that in private mode it will only not save history or cache on the user's browser that can be retrieved later on. What I want to implement is a session storage for storing values during the session of the user on the browser. But will then be cleared once the browser is closed. I tried using in on incognito mode in Chrome and session storage is just working fine. But safari seems to disabled that feature. Is there anything you can recommend to use ? – banri16 Jun 29 '17 at 09:35
  • https://stackoverflow.com/questions/18860098/on-a-browser-sessionstorage-in-safaris-private-browsing-does-not-work-the-same – ziaulain Jun 29 '17 at 09:49

0 Answers0