js multi-page return, url encapsulation

/*-->>htmlRoute*/
function htmlRoute_forward(_url){
	if(!sessionStorage.htmlRoute){
		sessionStorage.htmlRoute = location.pathname+"$"+_url;
	}else{
		sessionStorage.htmlRoute=sessionStorage.htmlRoute+"$"+_url;
	}
	window.location.href = _url;
}
function htmlRoute_backward(i){//1 is the previous step, 2 is the second step. .
	if(i==undefined){
		i=1;
	}
	var arr = sessionStorage.htmlRoute.split("$");
	var prevStep = arr[arr.length-(i+1)];
	htmlRoute_backTo(prevStep);
}
function htmlRoute_backTo(jumpTarget){
	console.log(jumpTarget);
	sessionStorage.htmlRoute=sessionStorage.htmlRoute.substr(0,sessionStorage.htmlRoute.indexOf(jumpTarget)+jumpTarget.length);
	window.location.href = jumpTarget;
}
function htmlRoute_prev(){
	return sessionStorage.htmlRoute.substr(0,sessionStorage.htmlRoute.indexOf(location.pathname)-1);
}
/*--<<htmlRoute*/

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326641864&siteId=291194637