const { app, BrowserWindow } = require('electron');
const fs = require('fs');
function createWindow() {
const mainWindow = new BrowserWindow({
width: 1600,
height: 900,
webPreferences: {
offscreen: true,
},
});
let i = 0;
mainWindow.webContents.on('paint', (event, dirty, image) => {
fs.writeFileSync(`${i}.png`, image.toPNG());
++i;
});
mainWindow.loadURL("http://jl.people.com.cn/n2/2025/0721/c349771-41297182.html");
mainWindow.focusOnWebView();
}
app.whenReady().then(() => {
createWindow();
app.on('activate', function () {
if (BrowserWindow.getAllWindows().length === 0) createWindow();
});
});
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit();
});
Preflight Checklist
Electron Version
37.2.0
What operating system(s) are you using?
Windows
Operating System Version
window 11 24H2
What arch are you using?
x64
Last Known Working Electron version
15.5.3
Does the issue also appear in Chromium / Google Chrome?
No
Expected Behavior
@media will used
Actual Behavior
37.2.0
15.5.3
other related issues :#34095
Testcase Gist URL
No response
Additional Information
main.js