您的位置:首页 > 其它

新窗口打开静态url

2015-09-22 12:06 295 查看
<a id="downLink" href="" onclick="downloadfile()" target="_blank" ></a>

function downloadfile() {

var id = $('#id').val();

var custDocFileVisitPath = $('#custDocFileVisitPath').val();

var filename = $('#filename').val();

var url = 'http://192.168.1.165:8081/customer/112/测试.png';

//var url = 'http://192.168.1.165:8081/customer/103/test.png';

if(id!=null && id!=''){

//window.open(encodeURI(encodeURI(url)));

document.getElementById("downLink").href = encodeURI(encodeURI(url));

}

}

如果是走服务端,并且文件路径有中文,需要在页面encodeURI(encodeURI(url));

String url= URLDecoder.decode(url,"UTF-8");
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: