当前位置: 代码迷 >> JavaScript >> js 红狐下取本地路径
  详细解决方案

js 红狐下取本地路径

热度:71   发布时间:2013-04-07 12:50:11.0
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;
    }
}

  相关解决方案