簡體   English   中英

javascript如何在遠程服務器中打開pdf文件

[英]javascript how to open a pdf file in a remote server

我想使用JavaScript在窗口中打開pdf文件。 該文件位於遠程服務器中,路徑為/bd1/sgacp/sigcp/tempECALCP/survey15es.pdf。

我寫了以下函數

function leerServerFile(){
     console.log('principio de leerServerFile');
     var request = $.ajax({
         type:    "GET",
         url:"/bd1/sgacp/sigcp/tempECALCP/survey15es.pdf",
         onSuccess:function(response){
             console.log("leerServerfile response ",response);
             //The response text is available in the 'response' variable
             //Set the value of the textarea with the id 'csvResponse' to the response
             $("file-content").value = response;
         }
     });

    }

如何在遠程服務器上寫url文件?

路徑為/bd1/sgacp/sigcp/tempECALCP/survey15es.pdf

具有相同起源的Ajax限制禁止您這樣做。 不用擔心:只需使用以下iframe:

<iframe src="REMOTESERVERPATH/bd1/sgacp/sigcp/tempECALCP/survey15es.pdf"></iframe>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM