abc
abc

Reputation: 1559

What is a frame in Chrome browser extensions?

In the extension API, there is a parameter for the manifest.json called all_frames

Optional. Defaults to false, meaning that only the top frame is matched.

If specified true, it will inject into all frames, even if the frame is not the topmost frame in the tab. Each frame is checked independently for URL requirements, it will not inject into child frames if the URL requirements are not met.

I'm familiar with frames as in frames per second, but that doesn't seem to apply here. What is meant by "only the top frame is matched"? Is "frame" the same thing as tab?

Upvotes: 6

Views: 2126

Answers (1)

true_gler
true_gler

Reputation: 573

Frames exist inside a Tab and Frame IDs are unique within a tab.

As from the documentation:

Frames within a tab can be identified by a frame ID. The frame ID of the main frame is always 0, the ID of child frames is a positive number. Once a document is constructed in a frame, its frame ID remains constant during the lifetime of the document.

getAllFrames
chrome.webNavigation.getAllFrames(
  details: object,
  callback?: function,
)

This retrieves information about all frames of a given tab.

Upvotes: 3

Related Questions