Electron: Renderer process not rendering navbar












0















I'm new to electron and I'm trying to display a simple navbar in the renderer process of Electron with the following html code:



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'">-->
<link rel="stylesheet" href="../../node_modules/bulma/css/bulma.min.css">
<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://bulma.io">
<img src="https://bulma.io/images/bulma-logo.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
</a>
</div>

<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>

<a class="navbar-item">
Documentation
</a>

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
</a>

<div class="navbar-dropdown">
<a class="navbar-item">
About
</a>
<a class="navbar-item">
Jobs
</a>
<a class="navbar-item">
Contact
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Report an issue
</a>
</div>
</div>
</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>
</body>
</html>


And it works fine if I open this html file with firefox, but the renderer process only display the logo, not the menu. Here is the main process code:



exports.createWindow = () => {

// TODO only use in dev mode
require('devtron').install();

const primary_display = electron.screen.getPrimaryDisplay();

this.win = new BrowserWindow({
width: primary_display.size.width / 1.5, height: primary_display.size.height / 1.5,
minWidth: primary_display.size.width / 2, minHeight: primary_display.size.height / 2,
title: "Client v" + app.getVersion(),
show: false
});

// Open dev tools
this.win.openDevTools();

// Allow to directly show the app in a native app style
this.win.once("ready-to-show", () => {
this.win.show()
});

// and load the main.html of the app.
this.win.loadURL(`file://${__dirname}/../renderer/main.html`);

// Emitted when the window is closed.
this.win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
this.win = null;
});

// Build menus from template
Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu.getMenuTemplate(this.win)));
const mainSession = this.win.webContents.session;
};


And here are the results.
When opening the html file with firefox:
enter image description here



And in the rederer process of electron:
enter image description here



Any idea why this happens? Thanks a lot!



EDIT: It seems that the electron renderer is rendering my webpage as a mobile webpage, I don't know why this happens.










share|improve this question

























  • If you go to the Elements tab, do you see any of those navs, or just the img tag

    – pushkin
    Nov 27 '18 at 21:55











  • I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

    – E-Kami
    Nov 28 '18 at 15:18
















0















I'm new to electron and I'm trying to display a simple navbar in the renderer process of Electron with the following html code:



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'">-->
<link rel="stylesheet" href="../../node_modules/bulma/css/bulma.min.css">
<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://bulma.io">
<img src="https://bulma.io/images/bulma-logo.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
</a>
</div>

<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>

<a class="navbar-item">
Documentation
</a>

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
</a>

<div class="navbar-dropdown">
<a class="navbar-item">
About
</a>
<a class="navbar-item">
Jobs
</a>
<a class="navbar-item">
Contact
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Report an issue
</a>
</div>
</div>
</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>
</body>
</html>


And it works fine if I open this html file with firefox, but the renderer process only display the logo, not the menu. Here is the main process code:



exports.createWindow = () => {

// TODO only use in dev mode
require('devtron').install();

const primary_display = electron.screen.getPrimaryDisplay();

this.win = new BrowserWindow({
width: primary_display.size.width / 1.5, height: primary_display.size.height / 1.5,
minWidth: primary_display.size.width / 2, minHeight: primary_display.size.height / 2,
title: "Client v" + app.getVersion(),
show: false
});

// Open dev tools
this.win.openDevTools();

// Allow to directly show the app in a native app style
this.win.once("ready-to-show", () => {
this.win.show()
});

// and load the main.html of the app.
this.win.loadURL(`file://${__dirname}/../renderer/main.html`);

// Emitted when the window is closed.
this.win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
this.win = null;
});

// Build menus from template
Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu.getMenuTemplate(this.win)));
const mainSession = this.win.webContents.session;
};


And here are the results.
When opening the html file with firefox:
enter image description here



And in the rederer process of electron:
enter image description here



Any idea why this happens? Thanks a lot!



EDIT: It seems that the electron renderer is rendering my webpage as a mobile webpage, I don't know why this happens.










share|improve this question

























  • If you go to the Elements tab, do you see any of those navs, or just the img tag

    – pushkin
    Nov 27 '18 at 21:55











  • I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

    – E-Kami
    Nov 28 '18 at 15:18














0












0








0








I'm new to electron and I'm trying to display a simple navbar in the renderer process of Electron with the following html code:



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'">-->
<link rel="stylesheet" href="../../node_modules/bulma/css/bulma.min.css">
<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://bulma.io">
<img src="https://bulma.io/images/bulma-logo.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
</a>
</div>

<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>

<a class="navbar-item">
Documentation
</a>

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
</a>

<div class="navbar-dropdown">
<a class="navbar-item">
About
</a>
<a class="navbar-item">
Jobs
</a>
<a class="navbar-item">
Contact
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Report an issue
</a>
</div>
</div>
</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>
</body>
</html>


And it works fine if I open this html file with firefox, but the renderer process only display the logo, not the menu. Here is the main process code:



exports.createWindow = () => {

// TODO only use in dev mode
require('devtron').install();

const primary_display = electron.screen.getPrimaryDisplay();

this.win = new BrowserWindow({
width: primary_display.size.width / 1.5, height: primary_display.size.height / 1.5,
minWidth: primary_display.size.width / 2, minHeight: primary_display.size.height / 2,
title: "Client v" + app.getVersion(),
show: false
});

// Open dev tools
this.win.openDevTools();

// Allow to directly show the app in a native app style
this.win.once("ready-to-show", () => {
this.win.show()
});

// and load the main.html of the app.
this.win.loadURL(`file://${__dirname}/../renderer/main.html`);

// Emitted when the window is closed.
this.win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
this.win = null;
});

// Build menus from template
Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu.getMenuTemplate(this.win)));
const mainSession = this.win.webContents.session;
};


And here are the results.
When opening the html file with firefox:
enter image description here



And in the rederer process of electron:
enter image description here



Any idea why this happens? Thanks a lot!



EDIT: It seems that the electron renderer is rendering my webpage as a mobile webpage, I don't know why this happens.










share|improve this question
















I'm new to electron and I'm trying to display a simple navbar in the renderer process of Electron with the following html code:



<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!--<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'">-->
<link rel="stylesheet" href="../../node_modules/bulma/css/bulma.min.css">
<link rel="stylesheet" href="../../node_modules/@fortawesome/fontawesome-free/css/fontawesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,700" rel="stylesheet">
<link rel="stylesheet" href="main.css">
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="https://bulma.io">
<img src="https://bulma.io/images/bulma-logo.png" alt="Bulma: a modern CSS framework based on Flexbox" width="112" height="28">
</a>
</div>

<div id="navbarBasicExample" class="navbar-menu">
<div class="navbar-start">
<a class="navbar-item">
Home
</a>

<a class="navbar-item">
Documentation
</a>

<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link">
More
</a>

<div class="navbar-dropdown">
<a class="navbar-item">
About
</a>
<a class="navbar-item">
Jobs
</a>
<a class="navbar-item">
Contact
</a>
<hr class="navbar-divider">
<a class="navbar-item">
Report an issue
</a>
</div>
</div>
</div>

<div class="navbar-end">
<div class="navbar-item">
<div class="buttons">
<a class="button is-primary">
<strong>Sign up</strong>
</a>
<a class="button is-light">
Log in
</a>
</div>
</div>
</div>
</div>
</nav>
</body>
</html>


And it works fine if I open this html file with firefox, but the renderer process only display the logo, not the menu. Here is the main process code:



exports.createWindow = () => {

// TODO only use in dev mode
require('devtron').install();

const primary_display = electron.screen.getPrimaryDisplay();

this.win = new BrowserWindow({
width: primary_display.size.width / 1.5, height: primary_display.size.height / 1.5,
minWidth: primary_display.size.width / 2, minHeight: primary_display.size.height / 2,
title: "Client v" + app.getVersion(),
show: false
});

// Open dev tools
this.win.openDevTools();

// Allow to directly show the app in a native app style
this.win.once("ready-to-show", () => {
this.win.show()
});

// and load the main.html of the app.
this.win.loadURL(`file://${__dirname}/../renderer/main.html`);

// Emitted when the window is closed.
this.win.on('closed', () => {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
this.win = null;
});

// Build menus from template
Menu.setApplicationMenu(Menu.buildFromTemplate(appMenu.getMenuTemplate(this.win)));
const mainSession = this.win.webContents.session;
};


And here are the results.
When opening the html file with firefox:
enter image description here



And in the rederer process of electron:
enter image description here



Any idea why this happens? Thanks a lot!



EDIT: It seems that the electron renderer is rendering my webpage as a mobile webpage, I don't know why this happens.







javascript html node.js electron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 17:34







E-Kami

















asked Nov 26 '18 at 17:20









E-KamiE-Kami

1,14731836




1,14731836













  • If you go to the Elements tab, do you see any of those navs, or just the img tag

    – pushkin
    Nov 27 '18 at 21:55











  • I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

    – E-Kami
    Nov 28 '18 at 15:18



















  • If you go to the Elements tab, do you see any of those navs, or just the img tag

    – pushkin
    Nov 27 '18 at 21:55











  • I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

    – E-Kami
    Nov 28 '18 at 15:18

















If you go to the Elements tab, do you see any of those navs, or just the img tag

– pushkin
Nov 27 '18 at 21:55





If you go to the Elements tab, do you see any of those navs, or just the img tag

– pushkin
Nov 27 '18 at 21:55













I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

– E-Kami
Nov 28 '18 at 15:18





I ended up using semantic-ui where I didn't have this issue, wasn't able to get it work with bulma. Thanks for stepping in!

– E-Kami
Nov 28 '18 at 15:18












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53486103%2felectron-renderer-process-not-rendering-navbar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53486103%2felectron-renderer-process-not-rendering-navbar%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Lallio

Futebolista

Jornalista