openUrl cannot open in Safari

260 views
Skip to first unread message

GoodCoder

unread,
Oct 8, 2015, 4:20:58 AM10/8/15
to Google Mobile Ads SDK Developers
We have a DFPBannerView and ads that use admob.opener.openURL("http://somebrand.com", true) to open a web page in Safari. It has been working in the past but it doesn't work anymore. Pressing the link that calls this Javascript code does nothing at all.
 

If we use admob.opener.openURL("http://somebrand.com") or admob.opener.openBrowser("http://somebrand.com"), it works but opens the web page within our app. But even this in-app browser has problems: all links are dead.

What could be the cause of the problem? Is this a bug or is there something we need to do in our app?

We have seen this problem with both Google Mobile Ads SDK 7.1 and 7.5.1 on iOS 8 and 7. We're currently building with XCode 6.4.

I might need to note that the ad first opens an overlay (admob.opener.openOverlay) and the overlay then calls admob.opener.openURL.

Relevant code form ad (in DfP):

<body>
<a href="[%FullscreenURL%]" onClick="admob.opener.openOverlay('%%CLICK_URL_ESC_ESC%%[%FullscreenURL%]');
return false;"><img border="0" src="[%Image%]" width="%%WIDTH%%" height="%%HEIGHT%%"></a>
</body>



Relevant code from overlay:
<p class="centered" style="padding-top: 12px"><a onclick="admob.opener.openBrowser('http://somebrand.com/'); return false;" class="button big" href="http://somebrand.com/" target="_blank">Mehr erfahren</a></p>




Vu Chau (MobileAds SDK Team)

unread,
Oct 8, 2015, 4:49:01 PM10/8/15
to Google Mobile Ads SDK Developers
Hi Manuel,

You should be able to fire up Safari (already the default behavior) using admob.opener.openURL("http://somebrand.com", true).  The following are two thoughts that might help:
  1. Have you tried using an app-specific protocol to launch Safari directly?
  2. The URL not triggering Safari might be due to the fact that you are opening an overlay (which overrides the default behavior of launching Safari) first prior to calling .openURL() (see the release note for v6.10.0).
Let us know if that helps resolve this issue,

Vu Chau
Mobile Ads SDK Team

GoodCoder

unread,
Oct 8, 2015, 6:11:31 PM10/8/15
to Google Mobile Ads SDK Developers
Hi Vu

Thanks for your answer. But I'm still stuck.

I don't see how an app-specific protocol should help. After all, the ad should open a regular web page and not communicate with some other app.

And wouldn't it be possible that you check with your colleagues that implemented the SDK and the admob.opener code if admob.opener.openURL("http://somebrand.com", true) works from within an overlay or not? I don't have any access to these people. And the release note doesn't really cover my case. 

Regards
Manuel

Vu Chau (MobileAds SDK Team)

unread,
Oct 9, 2015, 10:43:44 AM10/9/15
to Google Mobile Ads SDK Developers
Hi Manuel,

Using app-specific protocol is another way you can try to force a creative to open in Safari.  I suggested this to you so that we can begin narrowing down on the possible causes of this issue.  A couple more questions:
  1. What happens when you try canOpen() and launch the ad from there if Safari is detected as installed?
  2. Could you privately (via the option available here on the forum) send us your DFP line item ID/network code so we can investigate the creative?
Thanks,

Vu Chau
Mobile Ads SDK Team

GoodCoder

unread,
Oct 9, 2015, 2:19:36 PM10/9/15
to Google Mobile Ads SDK Developers
Hi Vu

Thanks for your assistance in tracking down the problem. I just tried app-specific protocols (mailto:te...@example.com and fb://events). But they don't work. Nothing happens.

I'll send you the DfP line item ID in a minute.

I've also debugged the overlay web view from Safari. I can see that the correct HTML is loaded and i can even step into admob.opener.openUrl and verify that the correct parameters are passed. Furthermore, I know that if finally results in a message being sent to the UIViewDelegate of the UIWebView (webView:shouldStartLoadWithRequest:navigationType:). However, I haven't checked the passed parameters yet (as my XCode 6.4 always crashes when the debugger stops).

Regards
Manuel

GoodCoder

unread,
Oct 9, 2015, 2:35:11 PM10/9/15
to Google Mobile Ads SDK Developers
Hi Vu 

I'm unable to find the option to send you the DfP info privately. Next to the reply icon, there's a drop-down menu (tooltip: more message actions). But I can't find any option for replying privately. I've also read in the help documentation that there is supposed to be a "Reply to Author" item in the same menu as the "Forward" item. I do have "Forward" but not "Reply to Author". Can you help me locate it?

Regards
Manuel

GoodCoder

unread,
Oct 9, 2015, 3:47:40 PM10/9/15
to Google Mobile Ads SDK Developers
Hi Vu

I might have made considerable progress in finding the cause of the problem. In all our view controllers, we remove the DFPBannerView instance in viewDidDisappear. Unfortunately, this method isn't just called when a new view controller is pushed onto the navigation stack but when the overlay opens as well. So when the link for Safari is clicked, the DFPBannerView no longer exists...

So I think we can find a solution ourselves.

BTW: The reason to remove the DFPBannerViews is that we have a user interface with four tabs and each tab has a navigation controller that can build a stack of up to 20 view controllers, each displaying at least one banner. So we could easily have 40 or more view controllers with banner views if we didn't remove them. And 40 banner views take an incredible amount of memory and use more than 50% CPU (even on an iPhone 6). I suspect that the Javascript found in most creatives drives the memory and CPU requirements.

Thanks for your support
Manuel

Vu Chau (MobileAds SDK Team)

unread,
Oct 9, 2015, 4:53:47 PM10/9/15
to Google Mobile Ads SDK Developers
Hi Manuel,

Glad I was of assistance and that you were able to locate the culprit of the issue!

Let us know if you need anything else,

Vu Chau
Mobile Ads SDK Team

Reply all
Reply to author
Forward
0 new messages