JS 得到当前项目的全路径

来源:互联网 发布:博洋软件 编辑:程序博客网 时间:2024/05/21 13:25
<script type="text/javascript">    function getRootPath()     {      var pathName = window.location.pathname.substring(1);      var webName = pathName == '' ? '' : pathName.substring(0, pathName.indexOf('/'));      return window.location.protocol + '//' + window.location.host + '/'+ webName + '/';     }     alert (getRootPath());</script>

原创粉丝点击