Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[adblocker-electron] Reddit and X.com broken with fromPrebuiltFull #3819

Open
spikecodes opened this issue Mar 4, 2024 · 2 comments
Open

Comments

@spikecodes
Copy link

spikecodes commented Mar 4, 2024

Reddit doesn't load in Electron when either the ElectronBlocker.fromPrebuiltAdsAndTracking or ElectronBlocker.fromPrebuiltFull method is used on the session.

Code to reproduce is attached below. Here's a repo I made to test it.

const { app, BrowserWindow } = require("electron");
const { ElectronBlocker } = require("@cliqz/adblocker-electron");

let mainWindow;

function createWindow() {
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
    titleBarStyle: "hidden",
  });

  mainWindow.loadURL("https://reddit.com");

  mainWindow.webContents.openDevTools();

  ElectronBlocker.fromPrebuiltAdsAndTracking(fetch).then((blocker) => {
    blocker.enableBlockingInSession(mainWindow.webContents.session);
  });
}

app.on("ready", createWindow);

app.on("window-all-closed", () => {
  app.quit();
});

image

Some other websites I tested that seem to be broken from loading by either one or both of these blocking options:

Both do work, though, when using fromPrebuiltAdsOnly.

@spikecodes spikecodes changed the title [adblocker-electron] Reddit broken with fromPrebuiltAdsAndTracking and fromPrebuiltFull [adblocker-electron] Reddit and Twitter broken with fromPrebuiltFull Mar 5, 2024
@spikecodes spikecodes changed the title [adblocker-electron] Reddit and Twitter broken with fromPrebuiltFull [adblocker-electron] Reddit and X.com broken with fromPrebuiltFull Mar 5, 2024
@remusao
Copy link
Collaborator

remusao commented Mar 7, 2024

Hey, did you try creating the browser window using the settings shown in the example here? https://github.com/ghostery/adblocker/blob/master/packages/adblocker-electron-example/index.ts#L20

I know there are some isolation settings which can prevent the adblocker from working properly in Electron.

@spikecodes
Copy link
Author

Thanks for the quick response. Even with those settings, x.com and reddit.com don't load with fromPrebuiltFull (although they used to a couple months ago).
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants