简体   繁体   中英

link to pdf not working on mobile browser

I have a basic html link to a pdf file on a page, when clicked is opens the pdf on PC but on mobile nothing happens when the link is clicked. I have

<a href="linktofile.pdf" target="_blank">Click to pdf</a>

Can someone help advise how do I make it work on mobile (andorid & ios) so that users can just click to download the pdf?

Thanks!

try using the full link like http://example.com/linktofile.pdf . If still you get a problem, then try checking with your friends phone. I've just now checked with my website, it's working with Chrome built-in browser. Also check for default PDF Viewer.

Try without target. I would use modal to view external files such as PDF, images, etc..

thanks for all the response.

I found the problem was not on the a href but rather on the css class. there was a class used causing the link un-clickable on mobile which made it not responding to any tap. once the class is removed everything worked fine.

sorry for my careless mistake.

Thank for all you time guys.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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