Home  >  Article  >  Web Front-end  >  js 火狐下取本地路径实现思路_javascript技巧

js 火狐下取本地路径实现思路_javascript技巧

WBOY
WBOYOriginal
2016-05-16 17:38:331080browse
复制代码 代码如下:

/* 火狐下取本地全路径 */
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;
}
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn