[adblocker-electron] Reddit and X.com broken with `fromPrebuiltFull`
spikecodes opened this issue · comments
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();
});
Some other websites I tested that seem to be broken from loading by either one or both of these blocking options:
- https://x.com broken with
fromPrebuiltFull
- https://reddit.com broken with
fromPrebuiltFull
andfromPrebuiltAdsAndTracking
Both do work, though, when using fromPrebuiltAdsOnly
.
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.