Chrome Extension Block a certain pattern of url

451 Views Asked by At

I am building a chrome extension that blocks images from a certain host address. However, as google proxies the images, I am not able to figure out the url pattern to use in chrome webrequest api.

The url would be something like this.

https://ci6.googleusercontent.con/proxy/hashds93932932-0-3123_#https://targethost.com/track?=trackparams

1

There are 1 best solutions below

0
Ijaz Khan On

Okay, so as @wOxxOm pointed out that I need to check the value of details.url. { details is what that webrequest API returns in the callback}. I needed to apply regex on the link and that worked for me. If regex fails then return {cancel:false} otherwise {cancel:true}. cancel:true blocks the web request.