Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,200,419 members, 7,974,709 topics. Date: Monday, 14 October 2024 at 10:05 AM |
Nairaland Forum / Science/Technology / Programming / I Need Active Tab To Stay Open On Refresh (261 Views)
How Long Should Refresh Tokens Last / JWT Token Refresh Automatize In Alteryx? / Web page Auto Refresh with Selenium (2) (3) (4)
(1) (Reply)
I Need Active Tab To Stay Open On Refresh by Karleb(m): 9:26pm On Apr 11, 2021 |
Hey guys! I have these tabs. Mainly HTML, CSS and Vanilla JS which I got from W3schools. It displays different items on click but I want it to stay on a active tab even if the page is refresh. https://codepen.io/karlebh/pen/LYxQyLW?editors=1000 I am really confused at this one. I am thinking local or sessionStorage would be a better fit but I can't just wrap my head around the implementations. |
Re: I Need Active Tab To Stay Open On Refresh by Jummate(m): 10:49pm On Apr 11, 2021 |
Karleb: I think localStorage or sessionStorage will work. I'd go for localStorage given that it is permanent. When a tab is clicked, save the reference of the clicked tab in localStorage in such a way that the reference to the recently clicked tab always overwrites the reference to the previously clicked tab. All these happen in the localStorage. With this, tweak your code to always load the reference to the last active tab from the localStorage upon reload/refresh. This way, the active status will be triggered on the reference loaded from the localStorage. I am not sure if this would help completely but I am sure you would be able to pick something from it. Well done bro. 2 Likes |
Re: I Need Active Tab To Stay Open On Refresh by Csami(m): 11:49pm On Apr 11, 2021 |
Don't know if it's possible though. Mine was to display data from my database onclick. Lemme checkout this local storage |
(1) (Reply)
Network Error When Posting Or Quoting Someone... / QR Code Generate With Python / Wh
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 69 |