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:

 

相关文章:

  • 2022-12-23
  • 2021-10-08
  • 2021-11-05
  • 2021-05-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-17
  • 2022-02-02
  • 2022-12-23
  • 2021-09-21
  • 2022-02-10
相关资源
相似解决方案