Does localStorage in Javascript get wiped off after clearing browser history

萝らか妹 提交于 2020-03-06 02:40:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!