The same HTML tag, different terminals, different situations, who to throw this pot to?

as detailed in the title:

this line of a tag code, click the link, the situation is different:

  • normal preview of PDF files on PC and iOS mobile browsers
  • android mobile browser, download it directly

I would like to ask: the same page is uneven at different terminals. Whose pot is this? Browser kernel? If it"s a browser kernel, how can I know how different kernels support a HTML tag attribute?

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0"/>
  <title>Document</title>
</head>
<body>
  <a href="" download="http://www.pospi.com/pdf/ismp3%20%E4%B8%AD%E6%96%87.pdf">PDF</a>
</body>
Mar.23,2021

throwing it to download, doesn't support it well.


this situation has been encountered before. Android browsers cannot parse pdf files by default, which requires the support of various plug-ins, and the project is tight. After thinking of a way, first convert pdf to html files on another server, and then set the jump in android webview for pdf links. Determine that if it is a pdf file, then directly change the strong value to the version of the link to html.


answer this question by yourself: when I was browsing the vue today, I accidentally found the module "vue-pdf", https://github.com/FranckFrei., which is compatible with the mobile end to preview the PDF file very well.

preliminary test, found that the effect of this module is much better than pdfjs, you can refer to! Haha, happy, found something new, I want to change the code! )


layer Lord Hello, I say a plan, I will see you personally.
  • since the responses to clicking on the a tag are varied, write the click event yourself
  • you can use js to determine the type of current browser and get your download link to do different processing

digression: this kind of pot is of course owned by the manufacturer.


can't solve your own back! Solved but not very good, throw it to the manufacturer!


change the default style or agree to the default style


Google Docs, cannot be used in China. I suggest you use https://pdfobject.com/. There should be no problems with mainstream browsers


https://caniuse.com/-sharpsearch=d.


I just dealt with this problem two days ago. Android can use pdfjs to preview pdf files (you can talk about it if you have any questions about this).

< hr >

PDF preview is encapsulated in each browser on PC. IOS native PDF reader can be adjusted to parse pdf, but Android native does not (on phones with google drive installed, you can also click a to directly preview), so you need to compensate manually.

< hr >

the pot can be thrown, but the effect should be uniform to ensure:)

Menu