chrome,fireFox获取绝对路径
在网上找了好多都说这个是兼容chrome,fireFox,可以获取文件的绝对路径
可我测试只在IE中可以。难道都是盲目的转载。自己都没测试过吗。还是我哪里不对。
兼容chrome,fireFox还有什么代码。这个能否用?
function getPath(obj) //参数obj为input file对象
{
if (obj) {
if (window.navigator.userAgent.indexOf("MSIE") >= 1) {
obj.select();
return document.selection.createRange().text;
}
else if (window.navigator.userAgent.indexOf("Firefox") >= 1) {
if (obj.files) {
return obj.files.item(0).getAsDataURL();
}
return obj.value;
}
return obj.value;
}
}