Cannot open local file - Chrome: Not allowed to load local resource

后端 未结 14 1633
不知归路
不知归路 2020-11-22 12:01

Test browser: Version of Chrome: 52.0.2743.116

It is a simple javascript that is to open an image file from local like \'C:\\002.jpg\'

function run(         


        
14条回答
  •  日久生厌
    2020-11-22 12:43

    This solution worked for me in PHP. It opens the PDF in the browser.

    // $path is the path to the pdf file
    public function showPDF($path) {
        if($path) {
            header("Content-type: application/pdf");
            header("Content-Disposition: inline; filename=filename.pdf");
            @readfile($path);
        }
    }
    

提交回复
热议问题