js中实现jsp中的basePath

<script type="text/javascript">
	var local = window.location;
	var contextPath = local.pathname.split("/")[1];
	var basePath = local.protocol+"//"+local.host+"/"+contextPath;
</script>

你可能感兴趣的:(js中实现jsp中的basePath)