1

I'm trying to open a new window from electron via a JavaScript file, it works, and opens the new window but I can't write HTML/text to new file. I'm getting that error :

Cannot read property 'write' of undefined

My simple code:

var myWindow = window.open("", "myWindow", "width=300, height=200");
myWindow.document.write ('content');  

Any advice or other way?

here's image from console: enter image description here

Shmulik
  • 134
  • 2
  • 10

1 Answers1

3

The documentation for window.open states that, by default, it uses a different implementation of window.open, where it returns a BrowserWindowProxy instance. You can change it to use the native chrome one by passing nativeWindowOpen: true as an option when creating the parent BrowserWindow.

Alexander Leithner
  • 3,169
  • 22
  • 33
RoyalBingBong
  • 1,106
  • 7
  • 15