1. 程式人生 > >JS中獲取JSP 中的basePath的方法

JS中獲取JSP 中的basePath的方法

轉自原文:https://blog.csdn.net/fuli_mouren/article/details/8992729

var local = window.location;
var contextPath = local.pathname.split("/")[1];
var basePath = local.protocol+"//"+local.host+"/"+contextPath;