Adguardforsafari: Advanced blocking rules in Safari

Created on 27 Dec 2018  路  5Comments  路  Source: AdguardTeam/AdGuardForSafari

Some types of rules require executing javascript on web pages which currently cannot be done.

I am talking about extended CSS rules and extended CSS support.

In theory, it should be possible to achieve using injected scripts and injected scripts <-> app extension messaging:
https://developer.apple.com/documentation/safariservices/safari_app_extensions/injecting_a_script_into_a_webpage

First of all, we need a proof of concept

Then if it's proven to be possible, here's the plan:

  1. Add new Safari extension: Advanced Blocking. It will inject the content script and communicate with it.
  2. This extension will work in a similar way to the content blocker extension. The app will pass a list of advanced rules to be used on the web pages (in the 'json' format for instance). On every page load, the content script will ask the extension if there are any advanced rules to use on the website. Then it will interpret the rules list.

We may even use the same format for the rules list as Safari uses for the content blockers (maybe they'll support any of these one day lol). Something like this:

{
    "css": "div { height: 10px }",
    "trigger": {
        "if-domain": [ "example.org" ]
    }
}
Feature request High

Most helpful comment

So, should ext-css and script rules continue to stay in Safari filters?

Sorry for the delay. Yeah, they should stay.

All 5 comments

Hi @ameshkov ,
I'm a little confused: will AdGuardForSafari support ext-css and script rules as in the old extension?

@superlex sorry for the delay. No, it does not, and that's what we're going to fix in this issue

Ok, thanks :)
So, should ext-css and script rules continue to stay in Safari filters?
https://github.com/AdguardTeam/FiltersCompiler/issues/27

So, should ext-css and script rules continue to stay in Safari filters?

Sorry for the delay. Yeah, they should stay.

Wow, thank you very much @ameshkov :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oleg-Chashko picture Oleg-Chashko  路  3Comments

justinlovesmen picture justinlovesmen  路  4Comments

interpretor picture interpretor  路  5Comments

freinbichler picture freinbichler  路  6Comments

kinoute picture kinoute  路  3Comments