0

I am making an Electron app that when a button is clicked it creates a new window and loads HTML into it, but for some reason the HTML isn't loaded into it and when I toggle developer tools for the window it shows me in the console this error:

"Not allowed to load local resource". It doesn't tell me a specific line.

const electron = require('electron');
const {ipcRenderer} = electron;
const {BrowserWindow} = electron.remote;

// NewTODO window variable
let newTodoWindow;

// Function to call when "New todo" button is clicked
function NewTodo(){
  // Creates a NewTODO window
  createTodoWindow();
}

function createTodoWindow(){
  newTodoWindow = new BrowserWindow({});
  newTodoWindow.loadFile("./newTodoWindow.html");
  newTodoWindow.setSize(400 , 400);
}

All it needs to do is that when createTodoWindow function is called(And it is called) it would create a new window and load the HTML to it, but it only creates the window without loading the HTML. I am not sure why that goes like and I would really appreciate getting help.

2
  • 1
    If you get console errors, it's a good idea not to paraphrase them, but to show them verbatim (just copy-paste them, and then put them in your post the same way you put a block of code), and explain which line number maps to which line of code you're showing in your post. Commented Dec 26, 2018 at 17:31
  • Possible duplicate of Electron - Not allowed to load local resource Commented Dec 27, 2018 at 5:55

1 Answer 1

0

So apparently this error occurs when trying to require a file that doesn't exist and that's exactly what I tried doing, For some reason I changed the file I tried requiring and just forgot to require the file with the right name.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.