--- title: Window.find() slug: Web/API/Window/find tags: - API - HTML DOM - Méthode - NeedsCompatTable - NeedsContent - Non-standard - Reference - Window - find translation_of: Web/API/Window/find ---
Note: La prise en charge de Window.find() pourrait changer dans les futures versions de Gecko. Voir {{Bug("672395")}}.
La méthode Window.find() trouve une chaîne dans une fenêtre.
window.find(aString, aCaseSensitive, aBackwards, aWrapAround,
aWholeWord, aSearchInFrames, aShowDialog);
aStringaCaseSensitivetrue, spécifie une recherche sensible à la casse.aBackwardstrue, spécifie une recherche vers l'arrière.aWrapAroundtrue, spécifie une recherche enveloppante.aWholeWord {{Unimplemented_Inline}}true, spécifie une recherche de mot entier. Ceci n'est pas implémenté; voir {{bug(481513)}}.aSearchInFramestrue, spécifie une recherche dans les cadres.true si la chaîne est trouvé; autrement, false.
findString = function findText(text) {
alert("String \x22" + text + "\x22 found? " + window.find(text));
}
<p>Apples, Bananas, and Oranges.</p>
<button type="button" onClick='findString("Apples")'>Search for Apples</button>
<button type="button" onClick='findString("Banana")'>Search for Banana</button>
<button type="button" onClick='findString("Orange")'>Search for Orange</button>
{{EmbedLiveSample("Example")}}
Dans certains navigateurs, Window.find() sélectionne (met en évidence) le contenu trouvé sur le site.
Cela ne fait partie d'aucune spécification.
Cette méthode fonctionne dans de nombreux navigateurs modernes, notamment Firefox, Chrome, et Safari.