Phonegap open documents from website

I am trying to open documents from a remote server in the PhoneGap application (2.8.1), on both iOS and Android. On iOS, it works with the following code snippet:

window.open(documentUrl, '_blank', 'location=no'); 

Unfortunately, this does not work on the Android platform (I see a white screen instead of a document). IOS is currently opening documents inside InAppBrowser (e.g. pdf, txt, doc document), does anyone know how to make this work on the Android platform? If possible, I would also like to ask the user to send the document to the installed application that supports the mime / content type, is this also possible?

+4
source share
1 answer

It works great for me on Android,

The only difference is that im uses it as var, so I can add eventlisteners to it, Example:

  mywindow = window.open('http://xxxxxx/hi.php', '_blank', 'location=no'); 

then u can add events such as exit, for example, you know when this window is closed, otherwise you cannot return to your application:

 mywindow.addEventListener('exit', myexitfunc); 

# Edit1 : make sure jQuery loads before trying to execute window.open

0
source

Source: https://habr.com/ru/post/1486554/


All Articles