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.
Note: Support for Window.find()
might change in future versions of Gecko. See Firefox bug 672395.
The Window.find()
method finds a string in a window sequentially.
find(aString, aCaseSensitive, aBackwards, aWrapAround, aWholeWord, aSearchInFrames, aShowDialog)
Parameters
aString
The text string for which to search.
aCaseSensitive
A boolean value. If true
, specifies a case-sensitive search.
aBackwards
A boolean value. If true
, specifies a backward search.
aWrapAround
A boolean value. If true
, specifies a wrap around search.
aWholeWord
A boolean value. If true
, specifies a whole word search.
aSearchInFrames
A boolean value. If true
, specifies a search in frames.
aShowDialog
A boolean value. If true
, a search dialog is shown.
true
if the string is found; otherwise, false
.
function findString(text) {
document.querySelector("#output").textContent = `String found? ${window.find(
text,
)}`;
}
HTML
<p>Apples, Bananas, and Oranges.</p>
<button type="button" onClick='findString("Apples")'>Search for Apples</button>
<button type="button" onClick='findString("Bananas")'>
Search for Bananas
</button>
<button type="button" onClick='findString("Orange")'>Search for Orange</button>
<p id="output"></p>
Result Notes
In some browsers, Window.find()
selects (highlights) the found content on the site.
This is not part of any specification.
Browser compatibilityRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.3