SOLFIND
Web Lens
Portal home

Web Embeds | Electron

https://www.electronjs.org/docs/latest/tutorial/web-embeds • 41 KB fetched
Open original page


Web Embeds | Electron tags, tags, and WebContentsView. Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option."/> tags, tags, and WebContentsView. Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option."/> Skip to main content Electron Docs API Blog Tools * Electron Forge * Electron Fiddle Community * Governance * Showcase * Resources Releases English * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Search * Get Started * Processes in Electron * Best Practices * Examples * Dark Mode * Device Access * In-App Purchases * * Keyboard Shortcuts * Deep Links * Desktop Launcher Actions * * Menus * Multithreading * Native File Drag & Drop * Navigation History * Notifications * Offscreen Rendering * Online/Offline Event Detection * Progress Bars * Recent Documents * * * Representing Files in a BrowserWindow * * SpellChecker * Web Embeds * Taskbar Customization * * Window Customization * Development * Native Node Modules * Distribution * Testing And Debugging * References * Contributing * * Examples * Web Embeds On this page Web Embeds Overview ​ If you want to embed (third-party) web content in an Electron BrowserWindow , there are three options available to you: <iframe> tags, <webview> tags, and WebContentsView . Each one offers slightly different functionality and is useful in different situations. To help you choose between these, this guide explains the differences and capabilities of each option. Iframes ​ Iframes in Electron behave like iframes in regular browsers. An <iframe> element in your page can show external web pages, provided that their Content Security Policy allows it. To limit the number of capabilities of a site in an <iframe> tag, it is recommended to use the sandbox attribute and only allow the capabilities you want to support. WebViews ​ info We do not recommend you to use WebViews , as this tag undergoes dramatic architectural changes that may affect stability of your application. Consider switching to alternatives, like iframe and Electron's WebContentsView , or an architecture that avoids embedded content by design. WebViews are based on Chromium's WebViews and are not explicitly supported by Electron. We do not guarantee that the WebView API will remain available in future versions of Electron. To use <webview> tags, you will need to set webviewTag to true in the webPreferences of your BrowserWindow . WebView is a custom element ( <webview> ) that will only work inside Electron. They are implemented as an "out-of-process iframe". This means that all communication with the <webview> is done asynchronously using IPC. The <webview> element has many custom methods and events, similar to webContents , that provide you with greater control over the content. Compared to an <iframe> , <webview> tends to be slightly slower but offers much greater control in loading and communicating with the third-party content and handling various events. WebContentsView ​ WebContentsView s are not a part of the DOM—instead, they are created, controlled, positioned, and sized by your Main process. Using WebContentsView , you can combine and layer many pages together in the same BaseWindow . WebContentsView s offer the greatest control over their contents, since they implement the webContents similarly to how BrowserWindow does it. However, as WebContentsView s are not elements inside the DOM, positioning them accurately with respect to DOM content requires coordination between the Main and Renderer processes. Edit this page Previous SpellChecker Next Taskbar Customization * Overview * Iframes * WebViews * WebContentsView Docs * Getting Started * API Reference Checklists * Performance * Security Tools * Electron Forge * Electron Fiddle Community * Governance * Resources * Discord * Bluesky * X * Mastodon * Stack Overflow More * GitHub * Open Collective * Infrastructure Dashboard Copyright OpenJS Foundation and Electron contributors. All rights reserved. The OpenJS Foundation has registered trademarks and uses trademarks. For a list of trademarks of the OpenJS Foundation , please see our Trademark Policy and Trademark List . Trademarks and logos not indicated on the list of OpenJS Foundation trademarks are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them. The OpenJS Foundation | Terms of Use | Privacy Policy | Bylaws | Code of Conduct | Trademark Policy | Trademark List | Cookie Policy Hosting and infrastructure graciously provided by

Links found on this page

  1. Skip to main content [direct]
  2. Electron [direct]
  3. Docs [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. Governance [direct]
  9. Showcase [direct]
  10. Resources [direct]
  11. Releases [direct]
  12. Deutsch [direct]
  13. Español [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. Processes in Electron [direct]
  20. Best Practices [direct]
  21. Examples [direct]
  22. Dark Mode [direct]
  23. Device Access [direct]
  24. In-App Purchases [direct]
  25. Keyboard Shortcuts [direct]
  26. Deep Links [direct]
  27. Desktop Launcher Actions [direct]
  28. Menus [direct]
  29. Multithreading [direct]
  30. Native File Drag & Drop [direct]
  31. Navigation History [direct]
  32. Notifications [direct]
  33. Offscreen Rendering [direct]
  34. Online/Offline Event Detection [direct]
  35. Progress Bars [direct]
  36. Recent Documents [direct]
  37. Representing Files in a BrowserWindow [direct]
  38. SpellChecker [direct]
  39. Taskbar Customization [direct]
  40. Window Customization [direct]
  41. Development [direct]
  42. Native Node Modules [direct]
  43. Distribution [direct]
  44. Testing And Debugging [direct]
  45. References [direct]
  46. Contributing [direct]
  47. Content Security Policy [direct]
  48. sandbox attribute [direct]
  49. We do not recommend you to use WebViews [direct]
  50. WebContentsView [direct]
  51. BaseWindow [direct]
  52. Edit this page [direct]
  53. Security [direct]
  54. Discord [direct]
  55. Bluesky [direct]
  56. X [direct]
  57. Mastodon [direct]
  58. Stack Overflow [direct]
  59. GitHub [direct]
  60. Open Collective [direct]
  61. Infrastructure Dashboard [direct]
  62. OpenJS Foundation [direct]
  63. Trademark Policy [direct]
  64. Trademark List [direct]
  65. Terms of Use [direct]
  66. Privacy Policy [direct]
  67. Bylaws [direct]
  68. Code of Conduct [direct]
  69. Cookie Policy [direct]