Jquery mobile 使用jquery mobile打开pdf

Jquery mobile 使用jquery mobile打开pdf,jquery-mobile,ibm-mobilefirst,Jquery Mobile,Ibm Mobilefirst,如何使用jQuery mobile打开PDF。 我正在使用worklight 6.o,适配器返回PDF的内容, var content='some PDF content'——我将从apadapter中获得它 contentType='PDF'——我将从适配器获得它。 我有内容和内容类型,基于此,我需要打开PDF,如果内容类型是PDF或word,如果内容类型是msword function onSuccessDownloadAdapter (results) { try {

如何使用jQuery mobile打开PDF。 我正在使用worklight 6.o,适配器返回PDF的内容, var content='some PDF content'——我将从apadapter中获得它 contentType='PDF'——我将从适配器获得它。 我有内容和内容类型,基于此,我需要打开PDF,如果内容类型是PDF或word,如果内容类型是msword

function onSuccessDownloadAdapter (results) {
          try {
              if(results.invocationResult.isSuccessful){
              if(results.invocationResult.stat == "ok"){
                  var content = results.invocationResult.content;
                  var contentType = results.invocationResult.contentType;
                 var embed = '<embed src=data:'+contentType+';base64,'+content+'>';
                     $("#dataContent").append(embed);
              }
              else{
                  alert("Stat fail:"+message);
                  WL.Logger.debug("Stat fail:"+message);    
              }
              }
              else{
                  alert("No connection");
                  WL.Logger.debug("downlaodAdapter onSuccess:: noConnection");  

              }  
              busyInd.hide();
          } catch (e) {
              busyInd.hide();
            displayError(e.toString());
          }

}
SuccessDownloadAdapter上的函数(结果){ 试一试{ if(results.invocationResult.issusccessful){ if(results.invocationResult.stat==“ok”){ var content=results.invocationResult.content; var contentType=results.invocationResult.contentType; var嵌入=“”; $(“#数据内容”)。追加(嵌入); } 否则{ 警报(“统计失败:+消息); WL.Logger.debug(“Stat fail:+消息”); } } 否则{ 警报(“无连接”); 调试(“downlaodAdapter onSuccess::noConnection”); } busynd.hide(); }捕获(e){ busynd.hide(); 显示错误(例如toString()); } }
这在浏览器中有效,但在移动设备中无效。

默认情况下,Android的WebView不允许嵌入PDF或Word文档

请看:

请看:


插件打开处理文档预览的外部应用程序。

并添加更多方法;如何获取文件以及如何查看文件。我在某处找到了此链接,请尝试此链接。也许对你有帮助。请详细说明您的问题,以便更好地理解。我在真实设备HTC上测试,它没有打开,也没有错误。msword与mobile有什么关系?我需要根据内容类型打开PDF或word文档。如果我从适配器获得PDF的内容,如何使用此文件Openeri使用过的类似于此窗口的文件。open('data:application/pdf;base64',+escape(PDFdata),'u system','location=yes'),引发错误,InAppviewer无法加载URL