js获取当前路径并截取

var str = window.location.href;// str = 'https://localhost:8080/mark'
var index = str .lastIndexOf(":");  

str  = str .substring(0,index + 1);

  console.log(str);//结果为:https://localhost:

 

相关文章: