HTMLIFrameElement.findAll()

我们的志愿者还没有将这篇文章翻译为 中文 (简体)加入我们帮助完成翻译
您也可以阅读此文章的English (US)版。

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The findAll() method of the HTMLIFrameElement searches for a string in a browser <iframe>'s text content; if found, the first instance of the string relative to the caret position will be highlighted.

Invoking this method results in a mozbrowserfindchange event firing, which carries details about the search results.

Note: Use of the Browser API requires a privileged app, and browser and/or embed-apps permissions, depending on what you want to do. See Using the Browser API for more details.

Syntax

instanceOfHTMLIframeElement.findAll(searchString, caseSensitivity);

Returns

Void.

Parameters

searchString
The string you want to search for in the browser <iframe>'s text.
caseSensitivity
A string to declare whether you want the search to be case sensitive (case-sensitive) or insensitive (case-insensitive.)

Example

The following function is taken from our Browser API demo, and executes a search when a search form is submitted. See Implementing the search bar for more explanation.

searchForm.addEventListener('submit', function(e) {
  e.preventDefault();
  browser.findAll(searchBar.value, 'case-sensitive');
  searchActive = true;
  prev.disabled = false;
  next.disabled = false;
  searchBar.blur();
});

Specification

Not part of any specification.

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic support
Non-standard
Chrome No support NoEdge No support NoFirefox Full support 47
Notes
Full support 47
Notes
Notes Supported in chrome code only.
IE No support NoOpera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoEdge Mobile No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android ?

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.
See implementation notes.
See implementation notes.

See also

文档标签和贡献者

此页面的贡献者: teoli, fscholz, chrisdavidmills, Sebastianz
最后编辑者: teoli,