javascript - Persistent CSS class change on HTML page -


suppose want let readers of html page adjust font size. can make simple button , onlick event via javascript change font-size property in corresponding css file - change body { font-size: 10px;} body { font-size: 12px;}.

however such changes not persist upon page reload, or when user moves different page. simplest solution save font-size under kind of variable last until browser closed? cookies way (meaning, there way same thing without having user download anything?).

any suggestion/reference appreciated.

i think you're looking html 5 storage mechanisms. quick rundown: localstorage lasts until cleared web-page, , sessionstorage lasts until browser closed.

both store data client-side.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -