var basePath = "/;jsessionid=E21C63F537707B1FC3FD2C7C3BA8C40D"; if(basePath.indexOf(";jsessionid")>0){ basePath = basePath.substring(0,basePath.indexOf(";jsessionid")); }