Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should it be used with Electron's <webview>? #17

Closed
eladams opened this issue Sep 6, 2016 · 4 comments
Closed

How should it be used with Electron's <webview>? #17

eladams opened this issue Sep 6, 2016 · 4 comments

Comments

@eladams
Copy link
Contributor

eladams commented Sep 6, 2016

No description provided.

@sindresorhus
Copy link
Owner

sindresorhus commented Sep 6, 2016

You pass a reference to the <webview> to the window option.
Webview support was just added a week ago: #15 ;)

@eyalap
Copy link

eyalap commented Apr 21, 2019

@sindresorhus Can you post an example of passing the reference please.
The docs are very minimal with actual usage examples.
Also, The webview I have in my app is created conditionally and isn't always there

@0kzh
Copy link

0kzh commented Apr 22, 2019

@eyalap
Say you have a webview like

<webview id="webview" src="http://google.com">

You can initialize the context menu using:

const contextMenu = require('electron-context-menu');

const webview = document.querySelector("#webview");
contextMenu({
  window: webview
});

@eyalap
Copy link

eyalap commented Apr 28, 2019

Thanks @Polunom , I didn't want to query the DOM from the main process every time I render a new webview.
In any case I used the workaround I was given in #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants