I'm actually using the following code to embed a PDF into a page:
code1:
<object data="/pdfs/test.pdf" type="application/pdf" width="100%" height="600">
alt : <a href="/pdfs/test.pdf">test.pdf</a>It works fine in desktop browsers, but on Android chrome browser, it will actually download the PDF instead of embedding it on the currently page. So, digging into the internet, I found that there is a trick to get it embedded into a page even on an Android browser, ie:
code2:
<iframe src="https://docs.google.com/gview?url=https://www.yoursite.com/yourpdf.pdf&embedded=true" style="width:100%; height:600px;" frameborder="0"></iframe>The solution looks ok.
My question is: what would be the best way to automatically use code1 if the browser is running in desktop machines, and code2 if it is on a mobile device.
Thanks!
