Android - document.write()阻止Google广告 - 双击

时间:2018-02-12 20:18:34

标签: javascript android double-click document.write

我发现了很多关于document.write()的问题,但没有一个问题可以解决我的具体问题。

简短说明

从DoubleClick接收广告的请求已成功完成,但广告未加载(空格而非看到广告),这些是Android Studio中logcat提供的警告:

A parser-blocking, cross site (i.e. different eTLD+1) script, SCRIPT_PATH, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.

The SSL certificate used to load resources from WEBSITE_PATH will be distrusted in the future. Once distrusted, users will be prevented from loading these resources. See https://g.co/chrome/symantecpkicerts for more information. SCRIPT_PATH

更长的版本

我有一个Android应用,其中包含带有DoubleClick库的Google广告。这些广告无法加载到某些较新的设备上(例如Android 7.0)。我怀疑较新版本的Android有较新版本的Chromium(55+),其中document.write()的处理已经改变。 https://developers.google.com/web/updates/2016/08/removing-document-write

因此,在加载一些广告时(在我的情况下,所有广告)我总是收到有关document.write()的警告,并且广告没有加载。

  • 双击没有任何错误(请求成功)。
  • 我没有任何消息说没有广告可供投放(广告在请求中正确收到)。

唯一的问题是广告因为尝试执行的JavaScript而无法加载。

直接更改JavaScript并不是一个好主意,因为它是在外部库提供的WebView中加载,这需要一些难看的反思。

使用的类:

  • com.google.android.gms.ads.doubleclick.PublisherAdView
  • com.google.android.gms.ads.doubleclick.PublisherAdRequest
  • com.google.android.gms.ads.doubleclick.PublisherAdRequest.Builder

我再说一遍,它适用于较旧的设备(我认为是Android 4.4)

0 个答案:

没有答案
相关问题