getLocalpath(); function getLocalpath(){ var currentPath = window.location.pathname; var url=currentPath.split("/html"); let usJosn=JSON.parse(us); let yq=getHtmlPermission(usJosn.menus,url[1]); console.log(yq) if(!yq){ console.log(url[1]) top.window.location.href = login_url; } } function getHtmlPermission(menus,html){ for (var i = 0; i < menus.length; i++) { var child=menus[i].childer; if(!child || child.length<1){ if(menus[i].url.indexOf(html)!='-1'){ return true; } }else{ let wyq=getHtmlPermission(child,html); if(wyq){ return true; } } } return false; }