0

I am trying to use electron's webFrame.executeJavaScriptInIsolatedWorld method but I get an error saying its not a function. I am trying to use this in a preload script of a webview.

import { webFrame } from 'electron'

webframe.executeJavaScriptInIsolatedWorld(123 , [{code: 'alert("hello")'}])

When I console log the webframe object and check its prototypes then
executeJavaScriptInIsolatedWorld is not present there so I understand why I am getting the error. But the electron docs (here) mentions that this method is available. I am a little confused by this. Am I using it in the wrong location? Can this not be used inside a webview's preload?

2
  • Which electron version do you use? Commented Jun 1, 2018 at 17:59
  • Electron version 1.7.11 Commented Jun 1, 2018 at 20:49

1 Answer 1

1

You are reading docs for 2.0.2 version of electron. 1.7.11 you use https://github.com/electron/electron/blob/v1.7.11/docs/api/web-frame.md doesn't have those interface.

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

1 Comment

Oh. I dont know how i missed that. Thanks.

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.