Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

private mode issue #145

Closed
pgherveou opened this issue Apr 30, 2014 · 18 comments
Closed

private mode issue #145

pgherveou opened this issue Apr 30, 2014 · 18 comments
Milestone

Comments

@pgherveou
Copy link
Contributor

Hello there

On Safari (Version 7.0.3) When I activate private mode non of the promise handlers get called.

I tested the following from the console after loading http://localhost:3000/test/test.html

localforage.setItem('foo', 'bar').then(
  function(res) { console.log('ok', res) },
  function(err) { console.log('ko', err) }
);
@tofumatt
Copy link
Member

Thanks for the report! I'll try to look at this before the 1.0 release.

In general, browsers seem to handle storage and private browsing together quite poorly. I recall Safari being especially bad but I forgot.

This might just be something we have to document (ie "private browsing mode doesn't work with localForage), rather than being able to fix. But I'll certainly try for a fix first.

When you load up the test page in private browsing mode, what is the output of localforage.driver()?

@pgherveou
Copy link
Contributor Author

Both private and non private return webSQLStorage

@tomchentw
Copy link

I came across localForage to solve the same Private Mode issue too. However, I found a demo page here: http://www.javascriptoo.com/localforage/example
and when I tried in console, the returned promise will be rejected. So I think that's what I need.

@jokeyrhyme
Copy link

Could be a duplicate of #70 ...

@tofumatt
Copy link
Member

Could you check to see if #448 helps at all? Using the latest version of master branch should allow you to test.

Hoping we can close this 😄

@JustinDrake
Copy link

JustinDrake commented Mar 30, 2017

localforage is still failing in private mode on Safari.

@tofumatt
Copy link
Member

Unfortunately private mode is not supported by localforage. It shouldn't cause the site to break but saving data in private browsing, even temporarily, doesn't work 😟

@thgreasi
Copy link
Member

Since we can't do a lot about the storage methods that each browser may or may not provide in private browsing mode, (breath)
how about suggesting to use the memoryStorageDriver as a last resort and close this issue?
Localforage should fallback to the memoryStorageDriver and the API we all love will continue to retrieve data, despite that they will be gone after the private browsing session ends.

@JustinDrake
Copy link

JustinDrake commented Mar 30, 2017

@tofumatt: I know that IndexedDB works in private mode, so in theory localforage could use that.

@thgreasi
Copy link
Member

thgreasi commented Mar 30, 2017

@JustinDrake What's the result of running this example under safari (in private mode)?

@JustinDrake
Copy link

screen shot 2017-03-30 at 16 18 56

@thgreasi
Copy link
Member

This pen uses localforage v1.5 which enables IndexedDB for safari v10.2+ .
If you are on safari < 10.2, then IndexedDB is not used because safari's implementation had some issue.
If you are on safari 10.2 and IndexedDB is not used in private mode, then I guess that safari doesn't provide it to be used under private mode.
Please elaborate.

@JustinDrake
Copy link

I'm using Safari Version 10.0.3. But I think version 10.1 is that latest stable release. Do you mean version 10.0.2?

@tofumatt
Copy link
Member

tofumatt commented Mar 30, 2017

I think I've mentioned before but yeah I'm cool with including memoryStorage driver at this point. Let's do that, maybe for 1.6.

@thgreasi
Copy link
Member

Agreed

@thgreasi
Copy link
Member

@JustinDrake my bad #650 & #651 mention 10.1+. Sorry for posting wrong version numbers.

@thgreasi
Copy link
Member

Merged a memory storage driver in v2.0-dev branch, which was the suggested way to resolve this.
If your browser allows you to use IndexedDB in private mode then 👍 if it doesn't, then the memory storage driver will be used and the LF API will still work and do not break your app. In both cases, when the private mode sessions gets closed, all stored data are lost. Depending on your browser though, different private mode tabs may or may not be able to access the stored data. Chrome allows store sharing across private tabs, while on FF each private tab is sandboxed on its own.

@jancama2
Copy link

@thgreasi How does it look like with release of this feature? The current version is 1.7.3 today, this PR is 2 years old. Would it be possible to add this PR to some 1.. version so we all can benefit from the memory driver?

I'm using localForage in couple of my packages and this issue started to be crucial for me as it crashes my app in FF private mode.

I could implement the memory driver for all my packages but it would be nicer to have it directly in localForage :).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants