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
Getting the WebContents
of an <iframe>
#26886
Comments
WebContents
of an iframe
WebContents
of an iframeWebContents
of an <iframe>
You can do this by catching the It might be nice to add a link to the new |
@nornagon, the Edit: I tried to use this event, but it's not detecting app.on('web-contents-created', function(event, webContents) {
console.log("[START] New WebContents!");
console.log(event);
console.log(webContents);
console.log("[END] New WebContents!");
}); |
@adel-sbeh not all |
How can I access the new |
There is no documentation for this API. (https://www.electronjs.org/docs/api/web-frame-main) |
#25464 I see that this is a beta feature. |
You can also do something like this:
I also want to mention that there is a related ticket to get control over iframes in webviews, which proposes a way to run preload scripts inside these iframes. Currently this is not possible, even though the docs state otherwise, so be aware of that. |
@Jelmerro, this only works with |
@adel-sbeh have you had a chance to see the updated documentation for the WebFrameMain API? Do you believe its functionality is sufficient for solving your problem? |
Is it somehow possible to change the url of an iframe which did the request from |
Bump. |
Preflight Checklist
Problem Description
I've once opened an issue about how the functionality of
disable-x-frame-options
in<iframe>
-s should get restored. (#26258)It didn't catch any attention. Anyway, I've found a solution to my problem:
But using this solution means that all
<iframe>
-s within my app will havex-frame-options
disabled.And, seeing that I can't use
<webview>
-s inside of<webview>
-s (#1130), there isn't any other solution that I can use.Proposed Solution
It'd be a good solution to be able to get the
webContents
of<iframe>
-s. This way, the developer would have some decent control over<iframe>
-s. Thus, there would be no need to reintroduce the functionality ofdisable-x-frame-options
. And developers would have a good alternative to<webview>
-s inside of<webview>
-s.Alternatives Considered
An alternative to introducing this feature would be restoring the functionality of
disable-x-frame-options
in<iframe>
-s (#26258), and fixing<webview>
-s inside of<webview>
-s. (#1130)Additional Information
Introducing this feature, instead of the alternatives, would be a much greater solution. So please consider doing so. Thank you!
The text was updated successfully, but these errors were encountered: