URL中包含url参数,(文件路径作为参数)

用encodeURIComponent方法,把路径放在里面,可以防止斜杠被取消。

以下attachfiles是我的一个文件的绝对路径。

window.location.href="${pageContext.request.contextPath}/competionFlow/attachfile?attachfiles="+encodeURIComponent(attachfiles);

原文地址:https://www.cnblogs.com/ly-520/p/10739943.html