webNavigation.onBeforeNavigate

Fired when a navigation is about to occur.

Syntax

browser.webNavigation.onBeforeNavigate.addListener(function(
  details // object
) {...})
browser.webNavigation.onBeforeNavigate.removeListener(listener)
browser.webNavigation.onBeforeNavigate.hasListener(listener)

Events have three functions:

addListener(callback)
Adds a listener to this event.
removeListener(listener)
Stop listening to this event. The listener argument is the listener to remove.
hasListener(listener)
Check whether listener is registered for this event. Returns true if it is listening, false otherwise.

addListener syntax

Parameters

callback

Function that will be called when this event occurs. The function will be passed the following arguments:

details
object.

Additional objects

details

tabId
integer. The ID of the tab in which the navigation is about to occur.
url
string.
processId
integer. The ID of the process runs the renderer for this tab.
frameId
integer. 0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process.
parentFrameId
integer. ID of frame that wraps the frame. Set to -1 of no parent frame exists.
timeStamp
number. The time when the browser was about to start the navigation, in milliseconds since the epoch.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?45.0Yes33
Firefox
Basic support48.0

Examples

Acknowledgements

This API is based on Chromium's chrome.webNavigation API. This documentation is derived from web_navigation.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg
 Last updated by: wbamberg,