我看到Google 来自 chrome.webrequest
到
chrome.declarativenetrequestRequestRequestRequest
。我看到静态规则我们允许用户每个网站上或关闭单个规则?大多数用户都希望白名单覆盖。这就是为什么我们使用 chrome.webrequest
来查看任何给定网页上的网络连接,如果这些URL中的任何一个与Regexp Ruleset匹配,我们可以否认该请求,并且JavaScript可以看见如果用户想在给定的网站上切换它以将其关闭以使其成为白名单。
declarativenetrequest
是否有办法查看任何网站并加载用户可以从选项面板中切换为给定网站的静态规则(白名单)?
I see that Google wants Chrome Extension developers to migrate from chrome.webRequest
to chrome.declarativeNetRequest
. I see static rules, but the trouble there is that how do we allow a user to toggle individual rules on or off per website? Most users want whitelisting overrides. This is why we used chrome.webRequest
to look at network connections on any given web page, and if any of those URLs matched a regexp ruleset, we could deny the request, and that Javascript could look to see if the user wanted to toggle that off on a given website to whitelist it.
Is there a way with declarativeNetRequest
to look at any website and load in static rules that a user could toggle off (whitelist) for a given website if they desire from their options panel?
发布评论
评论(1)
我如何避免在排除(白名单)域中应用DNR规则
?
只需创建一个排除的域的数组(可能会随着时间而变化),然后将此数组传递给具有更高优先级的动态规则。浏览器照顾其余的。
类似的内容:
每次用户添加/删除排除的域时,您都必须再次调用此功能。
更新规则所需的时间因使用的浏览器而异,在Safari中,按照现有静态规则的数量(在subtest.json中启用)。
在清单中预先启用了60,000多个静态规则:
时间是6-8秒(!!!),在这种情况下,尽管功能
由于野生动物园特定的DNR,与某些差异几乎相同
局限性,等待时必须使用其他技巧
苹果要定位以修复这种怪物)。
我最近在Apple Forum Forum上开了讨论关于这一点。
对于那些想自行测试DNR更新动力学API的人,。
How do I avoid the application of DNR rules on excluded (whitelisted) domains?
It is not necessary (better, I would say it is wrong) to touch the static rules.
Just create an array of the excluded domains (which may vary over time) and pass this array to a dynamic rule with higher priority. The browser takes care of the rest.
Something like this:
Every time the user adds/removes excluded domains, you have to call again this function.
The time it takes to update the rules varies depending on the browser used and, in Safari, by the number of pre existing static rules (enabled in manifest.json).
With over 60,000 static rules pre-enabled in manifest:
time is 6-8 seconds (!!!), and, in this case, although the function
is almost the same with some differences due to Safari specific DNR
limitations, additional tricks have to be used while waiting for
Apple to deign to fix this monstrosity).
I recently opened a discussion on the Apple forum about this very thing.
For those who want to test the performance of the DNR updateDynamicRules API on their own, I had created a repository about it on Github.