简体   繁体   中英

Android: Block Adsense ads in WebView with admob

我有一个带adsense的网站,其次我有一个带有该站点应用程序的android webview,此应用程序带有admob横幅,并且adsense块不需要产生冲突,谢谢。

If you are in phonegap/cordova, use this cordova and phonegap AdMob plugin to show AdMob ads.

Then you have 2 options:

  • Remove the adsense divs via javascript inside the app (show us your website code in order to give you more accurate help)
  • If you have access to the server from wich the content is being shown, render the content without the divs that contains adsense. You can use User Agent to render the content. (again show us the code which is rendering the page to help you more accurately)

If possible I recommend using the second option (less traffic and more consistent). In your server you can know that you are in your mobile app from the User Agent string. See here to setup user agent in Cordova/Phonegap.

If you are not using Cordova/Phonegap, firstly I would recommend you to use it and your live will be easier :), otherwise you should override the user agent string in the code. See android user agent and UIWebView iOS5 changing user-agent

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM