This can be done using HTML5 LocalStorage .
In the click handler, save the text of the active menu to localStorage:
$('#nav > li > a').click(function(e){ ... localStorage.setItem("activeSubMenu", $(this).text()); });
Download the page, read localStorage and expand the menu (if found):
$(document).ready(function(){ var activeItem = localStorage.getItem("activeSubMenu"); if(activeItem){ $('#nav > li > a').filter(function() { return $(this).text() == activeItem; }).slideToggle(); } });
source share