js 火狐下取本地路径实现思路 |
本文标签:js,火狐,本地路径 复制代码 代码如下: /* 火狐下取本地全路径 */ function getFullPath(obj) { if(obj) { //ie if (window.navigator.userAgent.indexOf("MSIE")>=1) { obj.select(); return document.selection.createRange().text; } //firefox else if(window.navigator.userAgent.indexOf("Firefox")>=1) { if(obj.files) { //return obj.files.item(0).getAsDataURL(); return window.URL.createObjectURL(obj.files[0]); } return obj.value; } return obj.value; } } |