0

I created a mobile app using Ionic framework. I want to create a webview on ionic. For that, I used cordova-plugin-inappbrowser plugin. Now, this plugin works, but plugin is not stable. I want to create webview with chrome browser and not with default browser. For that, I used browser crosswalk and removed cordova-plugin-inappbrowser plugin. But now, webview is not working. Now, when I use both browser crosswalk and cordova-plugin-inappbrowser plugins, webview gets a bad look. Any ideas on how to create webview with chrome browser?

Peter Haddad
  • 78,874
  • 25
  • 140
  • 134
Matrix12
  • 446
  • 8
  • 19

2 Answers2

1

If I understand correctly, you are asking not how to create a webview in the Ionic application, but how to open a external url in the default webbrowser of the phone?

You can do this by using the cordova-plugin-whitelist plugin. When this is installed, you can set several things, but I'll list the default I use below. This causes all external items to open outside the app (all this is from the config.xml file):

<access origin="*"/>
<allow-intent href="http://*/*" launch-external="yes"/>
<allow-intent href="https://*/*" launch-external="yes"/>
<allow-intent href="tel:*" launch-external="yes"/>
<allow-intent href="sms:*" launch-external="yes"/>
<allow-intent href="mailto:*" launch-external="yes"/>
<allow-intent href="geo:*" launch-external="yes"/>

acces origin="*" tells the app that it's allowed to acces all external resources, as * is the wildcard. After that using allow-intent with the launch-external attribute set to yes tells the app that all the links specified with the href attribute should be opened externally.

The code above makes sure that alles external websites, phonenumbers, textmessages, e-mail and even geo locations are opened in native apps. You need to make sure that all the links you use in the app use the format provided above.

Jur Clerkx
  • 698
  • 4
  • 14
  • Check post above your post. – Matrix12 Apr 11 '16 at 18:56
  • This solution gives the user the option to open up the link in an external app, in which the user has the choice of choosing his own app for it. However, I don't know if it is possible to open up chrome inside your own app. – Jur Clerkx Apr 12 '16 at 06:51
0

You can't embed Chrome into your app. The aesthetic you don't like is InAppBrowser's Toolbar - you will have to customize this by modifying the native code. Unfortunately right now InAppBrowser provides no API for customizing its toolbar style (I don't think you can leverage "injectCSS" but I could be mistaken)

Chicowitz
  • 5,759
  • 5
  • 32
  • 38