0

I tried ALL solutions

 navigator.app.loadUrl('http://www.google.fr', {openExternal:false});

function onDeviceReady(){
   window.location.href = 'http://www.google.fr';
 }

 window.open("http://google.com", "_system");

All open a NEW browser and leaves the cordova application !

I even tried some iframe solution but I got errors as well.

I succeed with inAppBrowser BUT, this solution is not good since it goes ON top of the application and hides admob ads displayed on application.

My goal is SIMPLY to display my website AS application: so cordova just naviagtes to external url on deviceReady !

yarek
  • 11,278
  • 30
  • 120
  • 219
  • 1
    You can try out themeable browser where you can have admob ads + inappbrowser features. link - https://github.com/initialxy/cordova-plugin-themeablebrowser. Let me know if it helps – Gandhi Aug 25 '16 at 09:59
  • DO you have a sample on how to use admob with themablebrowser ? – yarek Aug 25 '16 at 22:55
  • i dont have any. But we addressed a similar post sometime back with themeable browser and it worked as per the user's comment – Gandhi Aug 26 '16 at 07:07
  • Will dig up the post for you if possible – Gandhi Aug 26 '16 at 07:13

2 Answers2

1

Using the InAppBrowser Plugin you should be able to do:

cordova.InAppBrowser.open('http://apache.org', '_self', 'location=yes');

Notice the _self target in the second parameter. This will open the site in the app's WebView.

johnborges
  • 2,422
  • 20
  • 33
0

InAppBroswer plugin does the job of opening an external link within the app. But as per the question, if the intention is not to hide admob ads while opening the browser, then themeable browser plugin is the way to go i believe. It allows to control the elements getting displayed on the new browser.

I suggest you to check out this plugin Also please do look at this SO post which may help.

Community
  • 1
  • 1
Gandhi
  • 11,875
  • 4
  • 39
  • 63