[Webkit-unassigned] [Bug 162700] New: HTML files w/ localStorage being cached when running off file system

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 28 13:35:01 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=162700

            Bug ID: 162700
           Summary: HTML files w/ localStorage being cached when running
                    off file system
    Classification: Unclassified
           Product: WebKit
           Version: Safari 10
          Hardware: Macintosh
                OS: OS X 10.11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: History
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: seankmichael at gmail.com

I am experiencing difficulty with Safari 10 running html files off of the file system.  I do not run into this issue when running these files off of a server.

I am using JavaScript to set a value in localStorage on a button click with `localStorage.setItem('plan', index);` and then immediately redirecting the user with `window.location.href`.  When landing on the new page, I use `localStorage.getItem('plan');` to render corresponding data that is based on the 'plan' value.  When using all other modern browsers this works perfectly.  When running Safari 10 (11602.1.50.0.10) this only works correctly the first time you click the button and set the plan item in localStorage.  If I return to the original page and select a different button, which sets a different plan item, it will always revert to the first selected plan item.

I dug deep into this issue and have discovered that it is an issue with Safari cache.  When disabling cache or clearing cache, my button click will set the correct plan item (as expected) and not used cached localStorage.  I tried adding `meta http-equiv='expires' content='0'` tags to the head of my html files, but it still seems to cache the first localStorage value that was set.  I also tried adding query strings to the url's in the redirect, but this doesn't bust the cache either.  If I open a new tab or new window, the cache is not shared, so I am able to correctly select an item.  The odd part of this bug is that this does not occur when I run the html files off of a server, it only happens on the file system.  It does not occur in the newest versions of Chrome or FireFox for Mac either.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160928/d211e874/attachment-0001.html>


More information about the webkit-unassigned mailing list