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

[Bug]: Electron 19 don't load page on Windows 7 #34354

Closed
3 tasks done
PurpleHorrorRus opened this issue May 26, 2022 · 1 comment
Closed
3 tasks done

[Bug]: Electron 19 don't load page on Windows 7 #34354

PurpleHorrorRus opened this issue May 26, 2022 · 1 comment
Labels

Comments

@PurpleHorrorRus
Copy link

Preflight Checklist

Electron Version

19.0.1

What operating system are you using?

Windows

Operating System Version

Windows 7

What arch are you using?

x64

Last Known Working Electron version

18.3.1

Expected Behavior

Electron will load page from local within registered protocol

Actual Behavior

Electron stuck on loading page

Testcase Gist URL

No response

Additional Information

Electron creates app window, creates tray, but can't load page. App registers a protocol for loading a local index file.

import { protocol } from "electron";
import { URL } from "url";
import path from "path";

const PRODUCTION_APP_PROTOCOL = "app";
// eslint-disable-next-line no-undef
const PRODUCTION_APP_PATH = path.join(__dirname, "..", "renderer");

protocol.registerSchemesAsPrivileged([
    { 
        scheme: PRODUCTION_APP_PROTOCOL, 
        privileges: { 
            secure: true, 
            standard: true 
        } 
    }
]);

export default {
    register: () => {
        protocol.registerFileProtocol(PRODUCTION_APP_PROTOCOL, (request, callback) => {
            const pathname = path.normalize(new URL(request.url).pathname);
            const fullPath = path.join(PRODUCTION_APP_PATH, pathname);
            callback({ path: fullPath });
        });
    }
};

And then load it (code below was simplified)

app.once("ready", () => {
    protocol.register();
    window.loadURL("app://./index.html");
});

App don't load page on Windows 7. On Windows 10, Windows 11 and Linux distributions Electron 19 works well.

@PurpleHorrorRus
Copy link
Author

It seems error caused by os.gethostname()
Fixed in 20.2.0 (#35705)

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

No branches or pull requests

1 participant