Page 1 of 1

inAppBrowser Plugin not working

Posted: Sat Feb 27, 2021 8:15 pm
by Image3D

I am using the following code for open an pdf on the cordova inAppBrowser:

pdf2Render = "http://www.pdf995.com/samples/pdf";

var target = "_system";

Code: Select all

var options = "location=yes,hidden=yes,beforeload=yes,closebuttoncaption=CloseenableViewportScale=yes,fullscreen=no";

debugger;
window.open(pdf2Render, target, options);

On iOS device it should open the pdf file on Safari, but it does not.

Can you help?


Re: inAppBrowser Plugin not working

Posted: Mon Mar 01, 2021 3:37 pm
by Serhii Kulibaba

Hello,

You don't use the inAppBrowser in this example.

Please see the following links on how to use inAppBrowser in your project.

JQM apps: https://docs.appery.io/docs/cordova-jqu ... appbrowser

Ionic 1 apps: https://docs.appery.io/docs/cordova-ionic-inappbrowser

Ionic 4/5 apps: https://ionicframework.com/docs/native/in-app-browser
Here is a tutorial on how to include Ionic plugins into your project: https://docs.appery.io/docs/ionic-4-sol ... from-ionic


Re: inAppBrowser Plugin not working

Posted: Wed Mar 10, 2021 5:09 pm
by Image3D

Hi Serhii,

I think I found the problem. Building .ipa with library version v5.2 using the code bellow to open the system browser does not work on iOS.

Code: Select all

window.open(pdf2Render, target, options);

but building .ipa with library version v5.1 the code above works, ( I am using the same Cordova plugin in both versions), and opens the safari browser with the provided url.

Any idea what is causing the problem in library version v.2 ?

Regards Joni


Re: inAppBrowser Plugin not working

Posted: Mon Mar 15, 2021 11:46 am
by Image3D

I just did an exercise using the JQM apps: https://docs.appery.io/docs/cordova-jqu ... appbrowser tutorial, exported as a Xcode Project and build it with Version 12.2 .

Choosing System Browser it does not open the Safari browser as expected. It opens in the same WKWebView. ( see attached images).

We need a work around. Any ideas?

Regards Joni


Re: inAppBrowser Plugin not working

Posted: Mon Mar 15, 2021 4:34 pm
by Serhii Kulibaba

Hello,

Have you selected the latest Cordova version in your project? Please see here a solution how to fix the issue with "WKWebView" https://blog.appery.io/2020/07/importan ... age-error/


Re: inAppBrowser Plugin not working

Posted: Mon Mar 15, 2021 5:48 pm
by Image3D

Setting the cordova-plugin-ionic-webview gives a build error ( see log attached)..


Re: inAppBrowser Plugin not working

Posted: Mon Mar 15, 2021 10:07 pm
by Image3D

Found that when our App is tested from inside iOS Appery Tester window.open(pdf2Render, target, options); works just fine, but when we call it from an device installed version on the same device it does no opens the system browser.

What is different in Appery tester that allows window.open to open the Safari browser ?


Re: inAppBrowser Plugin not working

Posted: Tue Mar 16, 2021 6:29 pm
by Serhii Kulibaba

Hello,

You are right. Please use the in-app browser. Apple rejects simple window.open

What project type do you use here, Ionic 1, Ionic 4 or JQM?


Re: inAppBrowser Plugin not working ( Solved)

Posted: Wed Mar 17, 2021 1:36 pm
by Image3D

HI, review calling code for the following configuration:

  • Library version set to v5.2
    Cordova Plugins
  • InAppBrowser 4.00
  • OpenUrlExt 1.02[/list]

Used the following code with the OpenUrlExt Cordova Plugin (pdf2Render is the url to open)

if (isMobile.iOS() || isMobile.Android()) {
OpenUrlExt.open(pdf2Render,
function() {
console.log("ok");
},
function() {
console.log("ko");
});
} else {
window.open(pdf2Render, '_system');
}

Also using cordova.InAppBrowser.open(pdf2Render, '_system'); works. Important: test Cordova plugins calls only on device.

Hope the solution help others developersto call URL on device browsers.

Best Regards,

Joni


Re: inAppBrowser Plugin not working

Posted: Thu Mar 25, 2021 11:34 am
by Galyna Abramovych

Thanks for sharing this!