Understanding Inappbrowser Behavior in Monaca

Asked 2 years ago, Updated 2 years ago, 84 views

We are developing a hybrid iOS and Android app using Monaca.I'm trying to open the external URL in the inappbrowser, but the behavior is strange.

window.open(href, '_blank');

If so, the inappbrowser will start properly.

window.open(href, '_self');

If so, the inappbrowser may have started, but the return button (<) or close button (x) will not be displayed instead of the normal inappbrowser.In other words, if you open the inappbrowser, you will not be able to return to the app.I also put the inappbrowser plug-in in properly.

Something is wrong with the argument going from _blank to _self and not starting.

If window.open(href, '_self');, how do I start the inappbrowser properly?

monaca

2022-09-30 19:45

1 Answers

Basically, I can't, but
If you exclude the target URL from WhiteList, you will not be able to open it in CordovaWebView. Would it be possible to enforce InAppBrowser?
InAppBrowser has the optional ability to specify where to open it.

  • _self—Opens in Cordova's WebView if the specified URL is in WhiteList.
        Otherwise, open it in InAppBrowser.
  • Open with
  • _blank:InAppBrowser.
  • _system—Open in a web browser that is set to the operating system default.

However, please note that it is not a blacklist.
As it is a whitelist, only the URLs allowed can be accessed from CordovaWebView.
If it is the default setting, I think it allows all http or https.
Be careful when you are reading images to an external server or communicating with Ajax.


2022-09-30 19:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.