Header menu logo fable-electron-docs-api

webContents Type

⚠ Process Availability: Main ✔ | Renderer ❌ | Utility ❌ | Exported ✔

Render and control web pages.Process: MainwebContents is an EventEmitter. It is responsible for rendering and controlling a web page and is a property of the BrowserWindow object. An example of accessing the webContents object:### Navigation EventsSeveral events can be used to monitor navigations as they occur within a webContents.### Document NavigationsWhen a webContents navigates to another page (as opposed to an in-page navigation), the following events will be fired.* did-start-navigation* will-frame-navigate* will-navigate (only fired when main frame navigates)* will-redirect (only fired when a redirect happens during navigation)* did-redirect-navigation (only fired when a redirect happens during navigation)* did-frame-navigate* did-navigate (only fired when main frame navigates)Subsequent events will not fire if event.preventDefault() is called on any of the cancellable events.### In-page NavigationIn-page navigations don't cause the page to reload, but instead navigate to a location within the current page. These events are not cancellable. For an in-page navigations, the following events will fire in this order:* did-start-navigation* did-navigate-in-page### Frame NavigationThe will-navigate and did-navigate events only fire when the mainFrame navigates. If you want to also observe navigations in