简体   繁体   English

无法在Android设备上从PWA打开PDF文件

[英]Can't open PDF file from PWA on Android Device

This is just for the record, since I found the solution. 这只是记录,因为我找到了解决方案。

I experienced an Issue happening only on PWA Standalone App on Androïd device. 我遇到了仅在Androïd设备上的PWA Standalone App上发生的问题。

I used to open PDF file from my standalone VueJs application with this code : 我曾经使用以下代码从独立的VueJs应用程序中打开PDF文件:

window.open('<PDF FILE URL>')

or 要么

window.open('<PDF FILE URL>', '_blank')

In that case, the PDF couldn't be read on Android Device. 在这种情况下,无法在Android设备上阅读PDF。 I had this message 我有这个讯息

Impossible d'afficher le PDF/d'ouvrir 不可能的书PDF / d'ouvrir

I guess that in english error message would be something like : 我想英语中的错误消息是这样的:

Cannot display PDF/Open 无法显示PDF /打开

Note that in the other side 请注意,在另一侧

  • It works on standard browser (Chrome, Firefox, Internet Explorer) 它适用于标准浏览器(Chrome,Firefox,Internet Explorer)
  • It works on Apple Device (as PWA) 它可以在Apple Device上运行(作为PWA)
  • it works on Windows App (as PWA) 它可以在Windows App(作为PWA)上运行
  • I doesn't work on Android as PWA 我无法在Android上使用PWA

My solution was to simply change my code with : 我的解决方案是简单地使用以下命令更改代码:

window.location = '<PDF FILE URL>'

我的解决方案是简单地使用以下命令更改代码:

window.location = '<PDF FILE URL>'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM