Webview Ads blocker

You mentioned this as solution but it didn’t

if you want to bloack ads there is another solution, if your main website url contains specific text throghout pages then simpy you can do it like this using timer… after 100 ms if contains text = (your website specific text), then ok else web viewer go to url (your main website).

Again really @ombhat327

1 Like

Url has parameters specific to pagination or some redirection but not ads.
Ads works with javascript l

it’s not popup ads . it’s banner & interstitial ads .
They won’t stop with the clock

i need adblock javascript . please help

how to works it ?

Maybe this site can be useful to you:-

1 Like

many many thanks .I’m trying

1 Like

I’m just saying, this probably won’t work on the Play Store if you block their ads. What you need to do is to put your own ads outside the WebView, and contact the site owner. Reach an agreement that you block his ads and you donate 90% of at least 1 ad to the site owner. Then contact the Play Store and prove that the site owner is okay with you blocking ads.

Code with regular quotes:

var adlink="ad";
var timeout=60*60*24;
var showads = 1;
function adMessage(adcode) {
if (document.cookie == "") {
document.write(adcode);
} else {
var the_cookie = document.cookie;
the_cookie = unescape(the_cookie);
the_cookie_split = the_cookie.split(";");
for (loop=0;loop<the_cookie_split.length;loop++) {
var part_of_split = the_cookie_split[loop];
var find_name = part_of_split.indexOf("ad");
if (find_name!=-1) {
break;
   }
}
if (find_name==-1) {
document.write(adcode);
} else {
var ad_split = part_of_split.split("=");
var last = ad_split[1];
if (last!=0) {
document.write(adcode);
} else {
showads=0;
         }
      }
   }
}
function writeCookie(show) {
var today = new Date();
var the_date = new Date();
the_date.setTime(today.getTime() + 1000 * timeout);
var the_cookie_date = the_date.toGMTString();
var the_cookie = "ad="+show;
var the_cookie = the_cookie + ";expires=" + the_cookie_date;
document.cookie = the_cookie;
location.reload(true);
}
function handleClick(evnt) {
var targetstring = new String(evnt.target);
if (targetstring.search(adlink) != -1) {
writeCookie(0);
}
routeEvent(evnt);
return true;
}
if (window.Event) {
window.captureEvents(Event.CLICK);
}
window.onClick = handleClick;
adMessage(");

I don’t get what’s supposed to go into adMessage().

First of all this code only works if you provide link and second it not run in evaluate js block.
Assigning variable and funtion in evaluate js wont work

It isn’t my code, it’s from Remove Ads - The JavaScriptSource. (Webview Ads blocker)

I dont understand you?? can u explain me//

not working

i am Dissolving :rage: :rage: :hot_face: :tired_face: :weary:

As i said funtion didn’t work in evaluate js block.
This block only runs simple js

1 Like

So what’s the way?

Last thing is impossible to block ads in webviever

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.