4

I am using phonegap for ios . I need to open pdf file from external URL as popup . Here i used InappBrowser plugin its working fine but it showing full window. i need to show like popup.

Here is the code by using InAppBrowser plugin:

        <a href="#" onclick="window.open('http://www.us-cert.gov/sites/default/files/publications/CloudComputingHuthCebula.pdf', '_blank', 'location=no');">Show PDF</a>
user3350067
  • 75
  • 2
  • 10

2 Answers2

2

use google doc viewer is the best option ex:

window.open("http://docs.google.com/viewer?url=<place your doc location address>", '_blank', 'location=yes');

thats it.

Rahul
  • 710
  • 1
  • 8
  • 25
  • new window but if you close it you will be back into the application – Rahul Mar 04 '14 at 10:33
  • is there any possibility to open as popup – user3350067 Mar 04 '14 at 10:34
  • or you can do one thing you can create an iframe inside div or page then you can load it into that iframe and that iframe you can give any size and on clicking on cancell button kill iframe... i did this also and it was working – Rahul Mar 04 '14 at 10:40
  • by open as popup , user will also be able to see parent window – user3350067 Mar 04 '14 at 10:41
  • yes and that iframe you give inside overlay window so that it will look like a popup... or use window.open("","","width=200,height=100"); – Rahul Mar 04 '14 at 10:44
  • Does someone happend to know why this is not working for me also? I use an iphone 4 and a cordova 3. – paulalexandru Aug 14 '14 at 07:40
  • this solution is good but then how do you close the google viewer and go back to the app? – allwynmasc Oct 15 '14 at 11:33
  • @Rahul please put code examples if what you have tried has worked! – allwynmasc Oct 15 '14 at 11:40
  • using your back button provided in android or manual back for IOS. – Rahul Oct 16 '14 at 05:03
  • @rahul i got the pdf to open in the doc viewer but i can't get how to give a manual back btn to it. I'm on iOS. – allwynmasc Oct 16 '14 at 11:07
  • try to set window size lesser than your screen size and when you touch outside of popup it will be closed or andother way try using jquery mobile popup or use window.open("","","width=200,height=100"); in iframe. – Rahul Oct 16 '14 at 11:29
  • @Rahul i've created a thread here, could you pls take a look. Also do tag me in comments here, or else i dont get notified about them. – allwynmasc Oct 17 '14 at 06:26
  • @Rahul i was trying the idea about using dialogs, i've created a thread [here](http://stackoverflow.com/q/26398508/3421340) about using dialogue and iframe together, could you pls take a look. Also do tag me in comments here, or else i dont get notified about them. – allwynmasc Oct 17 '14 at 06:45
0

You can also use the FileOpener plugin for Cordova.

allwynmasc
  • 393
  • 5
  • 18
hriziya
  • 1,116
  • 1
  • 23
  • 41