问题
I have a little question.
Does localStorage get wiped off once the user clears the bowser history?
If yes, then is there a way that I can save a URL as a string on the mobile device somewhere which always stays there even if the user or any other application forces the browser history to be cleared.
And I can go get that string(URL) whenever I need it for my mobile app.
The thing is I want to save URL of a restful service which fetches updates to the mobile client. I want that whenever a user launches my mobile app for the first time only he should manually key-in that URL (that will be provided by me) to get the updates and then some how I use some JavaScript API to save that URL on mobile device(which user is never ever able to delete even if the browser history is deleted anyway)so that on every subsequent launch the user needs not to key-in that URL again for the updates and if the updates exit mobile app should automatically be able to get that saved URL and contact the service to fetch the updates.
Thanks.
回答1:
Does localStorage get wiped off once the user clears the bowser history?
Yes localstorage does get cleared when browser data is removed.
Save a URL as a string on the mobile device somewhere which always stays there even if the user or any other application forces the browser history to be cleared.
Are you refering to an actual mobile app or a website in a browser on a phone? If its a website within the browser then the answer is no.
If you are referring to an actual mobile app then there are several method to store data. You might want to expand you question if this is the case.
来源:https://stackoverflow.com/questions/26512449/does-localstorage-in-javascript-get-wiped-off-after-clearing-browser-history