I had inApBrowser working in my app just fine... however, I upgraded some things and now it opens the URL without any way of closing it. You have to kill the app.
I have tried many variations of this: window.open('http://cnn.com','_blank','location=yes,toolbar=yes');
myconfig.xml has:
<feature name="InAppBrowser">
<param name="ios-package" value="CDVInAppBrowser" />
</feature>
I get no errors... the page opens... but there is no way to close and return to the app. I have seen a lot of folks putting solutions for URL recognition and making the window close... but I need the childBrowser plugin method... where the user can close the window when he/she is finished viewing the page.
Phonegap 3.0 - JqueryMobile 1.2 - IOS 7.0.2 - xCode 5.0 -
Any help would be greatly appreciated!
There is no action to close the InAppBrowser. How can we achieve this? The user is redirected to an aws login page in the IAB and after suscessfull login the IAB should close and the user should be redirected to a screen in the app.
The InAppBrowser is a web browser view that displays when calling [window. open](window. open. html)() , or when opening a link formed as <a target="_blank"> . var ref = window.
You can show helpful articles, videos, and web resources inside of your app. Users can view web pages without leaving your app. To get a few ideas, check out the sample at the bottom of this page or go straight to the reference content.
Your syntax looks okay, but give these code snippets a try:
Pure JavaScript:
var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');
HTML + JavaScript:
<a href="#" onclick="var ref = window.open('http://cnn.com', '_blank', 'location=yes,toolbar=yes');">CNN Link</a>
Also, check that you have correctly installed the InAppBrowser plugin (PhoneGap/Cordova 3.0+ need it to be installed separately via the command line). Your config.xml file looks correct, but just make sure that the rest of the plugin is installed properly.
You can use the following commands to list all the installed plugins in your project...
Using Cordova: cordova plugins
Using PhoneGap: phonegap local plugin list
You can also just go to your Desktop, navigate to the 'plugins' folder within your project and check that there is a folder named 'org.apache.cordova.inappbrowser' or 'org.apache.cordova.core.inappbrowser' inside.
To install the InAppBrowser plugin (if necessary)...
Using Cordova: cordova plugin add org.apache.cordova.inappbrowser
Using PhoneGap: phonegap local plugin add org.apache.cordova.inappbrowser
From your description, it sounds like your page is opening within the app's webview, instead of the InAppBrowser window. This is the behaviour you would normally get if you used '_self'
instead of '_blank'
. Hopefully something here will help fix it.
If you are using PhoneGap Build then you need to use different syntax i.e. (see plugin info):
<gap:plugin name="org.apache.cordova.inappbrowser" />
See also PGB plugin repository. It seem to be up-to-date now. You can see a simple test application for a working version.
Note that this might not be working if you are building yourself (locally on your computer). Use instructions by wicketyjarjar if you are building locally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With