Non-standard: This feature is not standardized. We do not recommend using non-standard features in production, as they have limited browser support, and may change or be removed. However, they can be a suitable alternative in specific cases where no standard option exists.
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(string, caseSensitive, backwards, wrapAround, wholeWord, searchInFrames, showDialog)
stringThe text string for which to search.
caseSensitiveA boolean value. If true, specifies a case-sensitive search.
backwardsA boolean value. If true, specifies a backward search.
wrapAroundA boolean value. If true, specifies a wrap around search.
wholeWordA boolean value. If true, specifies a whole word search.
searchInFramesA boolean value. If true, specifies a search in frames.
showDialogA boolean value. If true, a search dialog is shown.
true if the string is found; otherwise, false.
<p>Apples, Bananas, and Oranges.</p> <button type="button" id="find-apples">Search for Apples</button> <button type="button" id="find-bananas">Search for Bananas</button> <button type="button" id="find-orange">Search for Orange</button> <p id="output"></p>
function findString(text) {
document.querySelector("#output").textContent = `String found? ${window.find(
text,
)}`;
}
document.getElementById("find-apples").addEventListener("click", () => {
findString("Apples");
});
document.getElementById("find-bananas").addEventListener("click", () => {
findString("Bananas");
});
document.getElementById("find-orange").addEventListener("click", () => {
findString("Orange");
});
In some browsers, Window.find() selects (highlights) the found content on the site.
This is not part of any specification.
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
find |
1 | 79 | 1 | 15 | 3 | 18 | 4 | 14 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Window/find