2 Replies Latest reply on Oct 8, 2017 5:51 PM by mattp81563445

    Cordova hybrid app with ads and external content


      I'm using Cordova to build an app from my web code. The site is using DoubleClick for ads and a couple external widgets (content loading in iframes) from other vendors. My main goal is to load the site in the app. Then whenever the user clicks on an ad or link in an iframe widget, it should open in the mobile browser (Safari/iOS, Chrome/Android). Any internal site links should just navigate inside the app and not open in the browser. So far, I have my app able to navigate "internal" site links in the app, but I want all external links to open in a browser (which isn't working). Here is the relevant config I am using so far:

      <content src="http://example.com/" /> 
      <allow-navigation href="https://*.example.com/*" />
      <allow-navigation href="http://*.example.com/*" />
      <allow-navigation href="https://*googlesyndication.com*" />
      <allow-navigation href="http://*googlesyndication.com*" />
      <allow-navigation href="https://*bankrate.com*" />
      <allow-navigation href="http://*bankrate.com*" />
      <access origin="*" />
      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />

      The googlesyndication.com allows the ads to load in the app (without this, the ads wouldn't appear). The bankrate.com allows the iframe widget content to load in the app (without it, the widget content wouldn't appear).

      When I click an ad or a link in a widget, the app navigates to the proper page, but it loads inside the app instead of opening it in a browser. This is especially tough on iOS that has no back button. How can I get it to load those external links in a new browser instead of my app?

        • 1. Re: Cordova hybrid app with ads and external content
          kerrishotts Adobe Employee

          Are you wrapping an external site with PhoneGap?


          If so, I advise you against it; the user experience for this is poor (especially with limited/no connectivity), and you'll almost certainly run afoul of Apple's own review process (which does not typically accept wrapped apps).


          What's the code look like that you're using for external links? It might help to see an example.

          • 2. Re: Cordova hybrid app with ads and external content
            mattp81563445 Level 1

            Yes, we are wrapping our mobile site.


            The code that we are having issues with is basically just Google/DoubleClick ads in the site.  They are loaded into the page via JS which creates iframes with content.  Then when/if a user clicks the ad, the app navigates away from out site to whatever was clicked on in the ad.  I'd prefer the add just open a new browser window so the user could go back to our app.