I thought I'd rewrite this and add a bit of context (more so it'll be easier to explain to me) .
Basicaly I'm capturing the back/forward buttons with the popstate event like so :
window.addEventListener("popstate", function(e) {
curstate = window.location.href ;
Then using a switch statement to determine what to do based on the new state :
switch (curstate) {
case 'http://mydomain.com/':
navi('about', 200);
break;
case 'http://mydomain.com/resume':
navi('resume', 200);
break;
};
});
The problem comes when the state is mydomain.com/portfolio/-whatever-
I need a case : starts with mydomain.com/portfolio/(capture this bit of the uri) : then put the captured bit in a variable eg currentpage = capturedbitofuri .
/^mydomain\.com\/portfolio\/(.*)$/Captured after it. What do you mean by pop?array_pop, he just means "put it in a variable"