<html>
 <head>
     <script>
         location.pathname.replace(/\/[^/]+$/,\'\'); //js获取当前项目跟目录
         alert(location.pathname);
         alert(location.pathname.replace(/\/[^/]+$/,\'\'));
     </script>
 </head>
 <body>
 
 </body>
</html>

 

版权声明:本文为conkis原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/conkis/articles/4603305.html