js中实现jsp中的basePath

来源:互联网 发布:string 函数 java 编辑:程序博客网 时间:2024/05/16 13:28
<script type="text/javascript">var local = window.location;var contextPath = local.pathname.split("/")[1];var basePath = local.protocol+"//"+local.host+"/"+contextPath;</script>