How To Keep Track Of Which Buttons Have Been Pressed After Page Reloaded?
I'm new to Javascript, and JQuery. After searching the internet for solutions, I decided to post this question. The problem: When the user clicks on a link within the iframe, it u
Solution 1:
Whatever you want to record on the client you basically have the same choices:
- cookies
- client-side storage
- url hash
or:
- round-trip to the server and store the data in the results page
Solution 2:
Something like localStorage
. The only drawback is that it is persistent even after rebooting etc, but you can reset the value if your complete website is reloaded. Also it's not supported by IE7 and lower.
functionupdateBar() {
if(localStorage['pressed'] == 'true') return; // abort if already pressed// do thingslocalStorage['pressed'] = 'true'; // save the data that it is pressed
}
Solution 3:
You probably want to do something like that on the server side. Keeping track of the state of data on a page is typically done on the server side, so that logic can be kept out of the interface. Makes maintenance much easier in the future.
Post a Comment for "How To Keep Track Of Which Buttons Have Been Pressed After Page Reloaded?"