'Electron hidden worker window is not working properly

i want to create a hidden window so that access it's indexeddb and perform other background operations

this is my worker.html

 
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="theme-color" content="#000000" />
    <meta
      name="description"
      content="Web site created using create-react-app"
    />
    <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
   

    <!-- Fonts -->
    <link
      href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
      rel="stylesheet"
    />
    <title>CartOS</title>
  </head>
  <body>
    <h1>Backend</h1>
     
  </body>
</html>

let mainWindow, backendWindow;

function createWindow() {
    const startUrl = process.env.DEV
        ? 'http://localhost:3000'
        : url.format({
            pathname: path.join(__dirname, '/../build/index.html'),
            protocol: 'file:',
            slashes: true,
        });
         
    mainWindow = new BrowserWindow({
        show: false,
        icon,
        webPreferences: {
            nodeIntegration: true,
            enableRemoteModule: true,
        },
        maxWidth: 1024,
        maxHeight: 700,
    });
    mainWindow.maximize();
    mainWindow.show();

    mainWindow.loadURL(startUrl);



    // create hidden backend window
    backendWindow = new BrowserWindow({
        show: true,
        webPreferences: { nodeIntegration: true }
    });
 
    backendWindow.loadFile('worker.html');
    


   
    process.env.DEV && mainWindow.webContents.openDevTools();

    mainWindow.on('closed', function () {
        loadBalancer.stopAll();
        mainWindow = null;
    });


    // once the window is created, load the product 
}

My main window opens and works fine. I changed the backend window to visible so I can see it but the backend window opens and get stuck in plain white but does not show any content. is there anything I am doing wrong and how can i fixed this?



Solution 1:[1]

There is no script in the index.html file to run.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Eggert