Mobile app version of vmapp.org
Login or Join
Odierno851

: Cause a PDF from a website to be viewed automatically, even on phones I have a PDF on my website. It works fine when on a computer, but on a phone, there is an extra step for the user.

@Odierno851

Posted in: #Download #Html5 #Mobile #Pdf

I have a PDF on my website. It works fine when on a computer, but on a phone, there is an extra step for the user. After going to the link with the PDF, they then have to click a link to view it. Is there anyway I can bypass this link? I am assuming not for security reasons, but figured I'd take a shot.

<object data="ResourcesmyPDF.pdf" type="application/pdf" width="100%" height="100%">
<p><a href="ResourcesmyPDF.pdf">It looks like you are on a phone. No worries though, just click on this text to
view my PDF in your mobile browser.</a></p>
</object>


If on a computer, myPDF.pdf opens and is shown in the browser when navigated to the page containing the above code. However, when on a browser, the link needs to be clicked in order to view myPDF.pdf. The only thing on the page is myPDF.pdf, so it is OK if nothing else is on the page. Any ideas?

I am looking for a generic solution for all phones, but the only phone I have actually been able to test it on is an iPhone using Safari. Other browsers may give a different result or require a different solution than the scenario I described above.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Odierno851

1 Comments

Sorted by latest first Latest Oldest Best

 

@Martha676

You can't force automatic PDF display on all devices because the ability to display embedded content (including pdf's) is dependant on the device having a program/plugin that can interpret the content. even when a desktop browser displays a embedded pdf automatically, it is using a bridge from a program or plug-in (like acrobat reader) to understand how to display the file/content being served to the browser. PDF isn't a native part of HTML language or the languages interpreted by web browsers, especially mobile browsers. Additionally, mobile devices (and desktops for that matter) can still have individual settings regarding security and/or embedded content that prevent the desired behavior. There are a lot of ways to help your desired action along but the direct answer to your question is no.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme