Reputation: 21
I have an app build via Ionic 4 (w/ Angular) calling the Cordova in-app browser plugin. After the splash screen, the in-app browser loads a URL that is a mobile-responsive website.
This website has urls such as:
The links that refer to someotherdomain.com
or domain.com/somefilename.pdf
typically have target="_blank"
within the mobile-responsive html code.
As it stand now (testing via iOS), the in-app browser will not open any of the target="_blank"
urls.
I've tried different settings and parameters, console.log()
, and testing via ionic cordova build ios --prod
, ionic serve
and ionic cordova run browser
.
openWebpage(url: string) {
const options : InAppBrowserOptions = {
location : 'yes'
,footer : 'no'
,hidenavigationbuttons : 'yes'
,hidden : 'no'
,hideurlbar : 'no'
,useWideViewPort : 'yes'
//,clearsessioncache : 'yes'
//,cleardata : 'yes'
//,clearcache : 'yes'
,zoom : 'no' // Android only, shows browser zoom controls
,hardwareback : 'no'
,mediaPlaybackRequiresUserAction : 'no'
,shouldPauseOnSuspend : 'no' // Android only
,closebuttoncaption : 'Close' // iOS only
,disallowoverscroll : 'no' // iOS only
,toolbar : 'yes' // iOS only
,enableViewportScale : 'yes' // iOS only
,allowInlineMediaPlayback : 'yes' // iOS only
,presentationstyle : 'fullscreen' // iOS only
,usewkwebview : 'no'
,toolbarposition : 'top'
,fullscreen : 'yes' // Windows only
};
const browser = this.inAppBrowser.create(url,'_self',options);
How can I:
window.alert()
for every href link click done via in-app browser (for debugging more easily)?Upvotes: 1
Views: 3824
Reputation: 2480
InAppBrowser uses _blank to open url if its listed in whitelist
. i'd suggest to use Apache Cordova Whitelist Plugin to whitelist the URLs you want to open.
add Cordova plugin
cordova plugin add cordova-plugin-whitelist
in config.xml
add <allow-intent>
tags with URLs, like
<allow-intent href="http://example.com/*" />
Upvotes: 1