获取当前页面的路径path

var host = window.location.protocol + '//' +window.location.host+'/';
var pathArray = window.location.pathname.split('/');
var baseUrl = host + pathArray.slice(1,pathArray.length-1).join('/');
console.log(baseUrl)

你可能感兴趣的:(获取当前页面的路径path)