html5 iframe实现页面预览pdf

一个可以把上传文件的绝对地址拿到的方法:

 //建立一个可存取到该file的url
    function getObjectURL(file) {
   
        var url = null;
        // 下面函数执行的效果是一样的,只是需要针对不同的浏览器执行不同的 js 函数而已
        if (window.createObjectURL != undefined) {
      // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) {
           // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) {
     // webkit or chrome
            url = window.webkitURL.createObjectURL(file) ;
        }
        return url;

你可能感兴趣的:(web前端,html5)