繁体   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