InAppBrowser plugin behaving differently: vs. _blank

5 posts, 1 answers
  1. Tim S.
    Tim S. avatar
    1 posts
    Member since:
    Mar 2013

    Posted 04 Jan 2014 Link to this post


    What Cordova says about the InAppBrowser plugin:
    " This plugin provides a web browser view that displays when calling, or when opening a link formed as <a target="_blank">. " (source)

    According to Cordova's documentation on the InAppBrowser I can do the following:

    function myFunction() {'', '_blank', 'location=yes');

    // on a html element like <a href="#" onclick="myFunction()">Link</a>

    ...which (how I interpret it) should have the same result as:

    <a href="" target="_blank">

    ...however, with the last html only approach it does not give me the same result as in the first javascript approach, namely

    1. Javascript approach: Opens url in InAppBrowser with toolbar and 'Done' button (i.e. all the default behaviour).
    2. HTML approach: Opens url in fullscreen 'iframe-like' window which allows scrolling, however no toolbar and 'Done' button
    Someone knows what is actually happening and why it is different? I desire to understand so I can approach my issue in a better way (which is that I prefer to use the html approach with the default InAppBrowser behaviour).

    I'm using Cordova 3.2.0 in Icenium Graphite for an iOS iPad app.
  2. Answer
    Steve avatar
    10941 posts

    Posted 08 Jan 2014 Link to this post

    Hi Tim,

    Both are different, so that is why your assumption is wrong. The HTML approach would open the link in the device's built-in browser, and as the browser is basically another app, there is no reference to the app it came from or a way to get back to it. That is one of the goals of the InAppBrowser approach, which opens in the context of your app and has a button so that you could easily get back to the app.

    You've missed the Icenium Visual Studio Integration keynote? It has been recorded and posted here.
    Looking for tips & tricks directly from the Icenium team? Check out our blog!
    Share feedback and vote for features on our Feedback Portal.
  3. Tim S.
    Tim S. avatar
    1 posts
    Member since:
    Mar 2013

    Posted 08 Jan 2014 Link to this post

    Thanks Steve, now it makes sense.
  4. Stroika
    Stroika avatar
    19 posts
    Member since:
    Aug 2012

    Posted 27 Mar 2014 Link to this post

    Nice Tim,
    but the done button in  InAppBrowser return me to the root (home//index) not to the last view,please tell me if there is perfect solution to make done button return me to the last view  

  5. Zdravko
    Zdravko avatar
    657 posts

    Posted 01 Apr 2014 Link to this post

    Hi Omar,

    In order to achieve your goal I will suggest using something like the code below:

    function myFunction() {
                var location= window.location.href;
                iab ='', '_blank', 'location=yes');
                iab.addEventListener('exit', function () {

    You can find more information about InAppBrowser events here.


    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET. Seats are limited.

Back to Top