Closed CarmenLexa closed 1 month ago
I could use some help with this as well, if someone could give an example on how to use contentBlocker, it would be appreciated!
Try this:
contentBlockers: [ ContentBlocker( trigger: ContentBlockerTrigger( urlFilter: '.*', resourceType: [ContentBlockerTriggerResourceType.IMAGE], ), action: ContentBlockerAction( type: ContentBlockerActionType.BLOCK, ), ), ],
Change the urlFilter and resoureType as you need.
Try this:
contentBlockers: [ ContentBlocker( trigger: ContentBlockerTrigger( urlFilter: '.*', resourceType: [ContentBlockerTriggerResourceType.IMAGE], ), action: ContentBlockerAction( type: ContentBlockerActionType.BLOCK, ), ), ],
Change the urlFilter and resoureType as you need.
This doesn't really work since I am trying to load normal images. Also, there are certain ads that are "overlays"? I'm not sure how else to explain it. I was thinking what if I inject a javascript adblocker into the webview? Do you have any thoughts on that @Vanilo?
Try this:
contentBlockers: [ ContentBlocker( trigger: ContentBlockerTrigger( urlFilter: '.*', resourceType: [ContentBlockerTriggerResourceType.IMAGE], ), action: ContentBlockerAction( type: ContentBlockerActionType.BLOCK, ), ), ],
Change the urlFilter and resoureType as you need.This doesn't really work since I am trying to load normal images. Also, there are certain ads that are "overlays"? I'm not sure how else to explain it. I was thinking what if I inject a javascript adblocker into the webview? Do you have any thoughts on that @Vanilo?
It's working .
Try this:
crossPlatform: InAppWebViewOptions(
useShouldOverrideUrlLoading: true,
mediaPlaybackRequiresUserGesture: false,
contentBlockers: [
ContentBlocker(
trigger: ContentBlockerTrigger( urlFilter: "http://.*aaa.*", resourceType: [ContentBlockerTriggerResourceType.SCRIPT], ),
action: ContentBlockerAction( type: ContentBlockerActionType.BLOCK, ), ),
],
),
android: AndroidInAppWebViewOptions(
useHybridComposition: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
));
Change the urlFilter and resoureType as you need.
urlFilter ↔ String A regular expression pattern to match the URL against. read / write
If you wanna filter some js named aaa.js
You can try this :
http://.*aaa.*
@oiolong Hello. How to put LIST from web sites into urlFilter method? "http://.*aaa.", "http://.bbb.", "http://.ccc.*" ?
This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.
I'm trying to use ContentBlocker to block ads but it doesn't work, I try to use onLoadResource but I don't know how to lock the resource before it loads, any ideas?