ClearURLs / Addon

ClearURLs is an add-on based on the new WebExtensions technology and will automatically remove tracking elements from URLs to help protect your privacy.

Home Page:http://docs.clearurls.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Manifest version from v2 to v3

inson1 opened this issue · comments

commented

V2 is being deprecated June 2024 https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline
so 3 months left to migrate.

V2 is being deprecated June 2024 https://developer.chrome.com/docs/extensions/develop/migrate/mv2-deprecation-timeline so 3 months left to migrate.

The onBeforeRequest API will be removed from Chrome with V3. This means that ClearURLs no longer works in Chrome. As for many other ad blockers and privacy addons, there is no alternative to replace this functionality. ClearURLs will therefore only work in Firefox and Chromium-based browsers that continue to offer the onBeforeRequest API.

@KevinRoebert Isn't the onBeforeRequest API used by ClearURLs only to redirect urls? In fact even in manifest V3, it is possible to use declarativeNetRequest to redirect to different URLs.

There is a official code example on Github exclusively for this: https://github.com/GoogleChrome/chrome-extensions-samples/tree/main/api-samples/declarativeNetRequest/url-redirect

See the google article to block and or redirect urls: https://developer.chrome.com/docs/extensions/develop/migrate/blocking-web-requests

EXAMPLE IN MANIFEST V2:

chrome.webRequest.onBeforeRequest.addListener((e) => {
    console.log(e);
    return { redirectUrl: "https://developer.chrome.com/docs/extensions/mv3/intro/" };
  }, { 
    urls: [
      "https://developer.chrome.com/docs/extensions/mv2/"
    ]
  }, 
  ["blocking"]
);

THE SAME EXAMPLE IN MANIFEST V3:

[
  {
    "id" : 1,
    "priority": 1,
    "action": {
      "type": "redirect",
      "redirect": { "url": "https://developer.chrome.com/docs/extensions/mv3/intro/" }
    },
    "condition": {
      "urlFilter": "https://developer.chrome.com/docs/extensions/mv2/",
      "resourceTypes": ["main_frame"]
    }
  }

It is primarily used to filter the tracking parameters.