Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

webNavigation.getAllFrames()

Given a tab ID, retrieves information about all the frames it contains.

Syntax

chrome.webNavigation.getAllFrames(
  details,                // object
  function(details) {...} // function
)

This API is also available as browser.webNavigation.getAllFrames() in a version that returns a promise.

Parameters

details
object. Information about the tab to retrieve all frames from.
tabId
integer. The ID of the tab.
callback
function. The function is passed the following arguments:
detailsOptional
array of object. An array of objects, one for each frame in the given tab. This is null if the specified tab ID is invalid.

Additional objects

details

Information about a single frame.

errorOccurred
boolean. True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired.
processId
integer. The ID of the process running the renderer for this tab.
frameId
integer. The ID of the frame. If this is the main frame, then frameId is zero.
parentFrameId
integer. ID of this frame's parent. This is -1 if there is no parent frame: that is, if this frame is the top-level browsing context in the tab.
url
string. The URL currently associated with this frame.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes Yes 47.0 48.0 33

Examples

This code logs the URLs of all frames in the active tab, when the user clicks a browser action:

function logFrameInfo(framesInfo) {
  for (var i = 0; i < framesInfo.length; i++) {
    console.log(framesInfo[i].url);
  }
}

function logActiveFrames(tabs) {
  var tabDetails = {
    tabId: tabs[0].id
  }
  chrome.webNavigation.getAllFrames(tabDetails, logFrameInfo);
}

chrome.browserAction.onClicked.addListener(function() {
  chrome.tabs.query({
    currentWindow: true,
    active: true
  }, logActiveFrames);
});

 

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

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