I have a navbar in my code. this is located in ejs file name nav.ejs
in Website whenever a page reloads its erase all previous setting which is made temporary(now your saving making your active tab for temporary), it means it doesn't save the things you have done in the page, to resolve this you need to use local storage, that keeps data of the active tab and whenever you reload the page that will assign the data it's kept. you can learn more about local storage in this .
hope this will give you some idea.