Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51461

html5 localStorage error when using safari in private mode

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.9.3
    • 2.9
    • JavaScript
    • MOODLE_29_STABLE
    • MOODLE_29_STABLE
    • Hide
      1. Open a Private Browsing tab in Safari
      2. Run the following code in the developer tools' Console:

        require(['core/localstorage'], function(s) {s.set('foo', 'bar');});
        

      3. Repeat on Safari (non-private), Chrome (private + non-private), IE (private + non-private), and Firefox (private + non-private).
      Show
      Open a Private Browsing tab in Safari Run the following code in the developer tools' Console: require(['core/localstorage'], function(s) {s.set('foo', 'bar');}); Repeat on Safari (non-private), Chrome (private + non-private), IE (private + non-private), and Firefox (private + non-private).

      One of my clients uses Safari in private mode a lot and had issues with a feature I developed which utilised the new templating engine. When Moodle renders the mustache template in browser it uses the localstorage system to cache things. In private mode safari reports local storage as being available but then throws an exception any time you try to write to it which totally breaks client side rendering of mustache templates. In order to solve this I have extended the detectSupport method in the core/localstorage javascript module to actually try to insert and remove an item, this solves the issue.
      I have no idea where in core Moodle client side js rendering is actually used so I cannot provide test instructions.

            andrew_dc_hancox Andrew Hancox
            andrew_dc_hancox Andrew Hancox
            Dan Poltawski Dan Poltawski
            Andrew Lyons Andrew Lyons
            Simey Lameze Simey Lameze
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.