JavaScript How to get the url of the BrowserWindow? browserwindow is not a constructor,browserwindow.adddevtoolsextension,browserwindow webcontents,browserwindow

This is a pretty basic question. In electron, how do I check the url/filename of a BrowserWindow?

let win;

app.on('ready', () => {
    win = new BrowserWindow();

    win.loadFile(path.join(__dirname, 'public', 'main.html'));

    win.on('closed', () => {
        app.quit();
    })
});

Ok, so say, this is the code, say after a certain event happens in a different (add:insert) BrowserWindow, I want to get the url from the main BrowserWindow (win).

let addWin;

ipcMain.on('createAddWin', ()=>{

    addWin = new BrowserWindow();

    addWin.loadFile(path.join(__dirname, 'public', 'add.html'));

    addWin.on('closed', () => {
        addWin = null
    });

ipcMain.on('add:insert', (e,insertObject) => {
//some event happens
//retrieve url from main window (win)
});

}); 

How do I go about this, I prefer to not have to send an event to the win to then send the url through ipcRenderer, though this is definitely possible.

Answer:1

I am writing an automation script to sign into draftkings.com. I am using sendKeys() to add my login credentials to the required fields. The first use of sendKeys() is for the username field which ...

I am writing an automation script to sign into draftkings.com. I am using sendKeys() to add my login credentials to the required fields. The first use of sendKeys() is for the username field which ...

I have a simple react component to which I want to add a simple math function named doMath that uses property values. class MyClass extends Component { constructor( props ) { super( ......

I have a simple react component to which I want to add a simple math function named doMath that uses property values. class MyClass extends Component { constructor( props ) { super( ......

  1. react component where to fetch data
  2. react component
  3. react component library
  4. react component did update
  5. react component did mount
  6. react component example
  7. react component constructor
  8. react component props
  9. react component state
  10. react component will receive props
  11. react component will mount
  12. react component lifecycle methods
  13. react component vs purecomponent
  14. react component will update
  15. react component style
  16. react component function
  17. react component unmount
  18. react component typescript
  19. react component class
  20. react component will unmount

I'm creating a 12 days of Christmas javascript program and when I print out the statement it keeps repeating the statement. Can you give me any suggestions on how to fix this and get the program to ...

I'm creating a 12 days of Christmas javascript program and when I print out the statement it keeps repeating the statement. Can you give me any suggestions on how to fix this and get the program to ...

I would expect the following code to create an element which contains a div with the text "Hi" in it. The element appears in the inspector, but no text is visible on the screen. When I change the ...

I would expect the following code to create an element which contains a div with the text "Hi" in it. The element appears in the inspector, but no text is visible on the screen. When I change the ...