新窗口打开静态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");
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");
相关文章推荐
- JDK源码阅读之HashMap类
- 招银网络科技面试
- 软件调试-调试符号
- Leetcode Valid Parentheses
- Win10怎么关闭系统提示音?
- svn
- HDCP版权保护机制
- 堆排序
- ITMS-90535
- Python脚本02 —— 删除以@3x.png为后缀的文件
- NPOI之Excel——合并单元格、设置样式、输入公式
- 一千行MySQL学习笔记(十二)
- Codeforces Round #268 (Div. 1) A. 24 Game 构造
- 定位 - MapKit-自定义大头针
- 归并排序
- JSP教程之使用JavaBean完成业务逻辑的方法
- 07-js正则验证文件后缀名
- hadoop 2.6 完全分布式安装过程及记录 (详细版)
- 正则表达式总结
- hihoCoder1233(2015北京网络赛H题)