I had a similar situation and ended up storing the value in a cookie, and used some generic JS cookie code to make it happen. With cookies your session info is available to any page where you can get a cookie, including partials. The cookie functions I used are:
//Cookie functions
function createCookie(name, value) {
//All cookies are session cookies that expire as soon as the browser is closed.
document.cookie = name + "=" + value + "; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function eraseCookie(name) {
//Since all cookies are session cookies, we only need to remove the data.
createCookie(name, "");
}
You can set up a date/time stamp if you want them to persist longer than the immediate browser session.