This is a migrated thread and some comments may be shown as answers.

InAppBrowser plugin odd behavior

1 Answer 147 Views
Apache Cordova
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Giancarlo
Top achievements
Rank 1
Giancarlo asked on 02 Sep 2015, 04:46 PM

I'm using AppBuilder within Visual Studio 2015 targeting Cordova 4.0 using Crosswalk in Android and WKWebView in iOS. I'm having some issues with the InAppBrowser core plugin. I have the following whitelist in the config.xml under App_Resources/Android/xml/config.xml and App_Resources/iOS/config.xml.

<access origin="*" />
<allow-navigation href="*" />

Additionally, in index.html I have the following Content-Security-Policy:

<meta http-equiv="Content-Security-Policy" content="default-src *;">

Basically everything is wide open for now during development.

Android Issue-

The app doesn't exactly seem to crash, but the splash screen shows when I execute the following code:

window.open(url);

iOS Issue-

The app does nothing when I execute the following code. Probably expected behavior for if a site isn't in the whitelist.

window.open(url);

When I dial down the Cordova version to 3.7 (followed by "Build and Deploy"), Android no longer shows the splash screen upon executing window.open(url) but iOS still doesn't do anything when executing window.open(url).

I appreciate any help you can offer.

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 07 Sep 2015, 03:27 PM
Hello Giancarlo,

I was able to replicate only one of the issues you reported - on an Android device using Crosswalk, the window.open(url) call opens the default Cordova WebView and invokes the splash screen. In order to workaround this issue you can set a target of "_blank" for the call and explicitly define that the external link should be opened in the InAppBrowser. Alternatively, you can look into using this new InAppBrowser Crosswalk plugin as it provides a web browser view, which is using the Crosswalk engine to render the external pages.

Both approaches work for me on Android and I was not able to detect any issues on an iOS device even if I don't set a target for the window.open() method. I attached the sample project I used for testing so you can have a look at it on your side and let me know if there is anything I am missing. The project is based on this InAppBrowser sample but it also incorporates the InAppBrowserXwalk plugin and the openExternalInAppBrowser() method is modified to take advantage of the custom plugin API.

Also, if you can replicate the iOS issues on a device with my project, please let me know the type and OS version of the device.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
Tags
Apache Cordova
Asked by
Giancarlo
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or