0

How can i search a specific keyword in webpage

On selecting a and submitting. In background specified keyword should be searched on specific webpage and display success or failure. Can someone help me out with this

2nd Jan 2018, 3:54 PM
unnamalai r
unnamalai r - avatar
1 Odpowiedź
+ 4
// Use var html = document.querySelector("html"); var txt = html.innerText; // to get the text of the whole webpage. // then use var search = txt.indexOf(searchStr); if(search != -1) alert(searchStr + " is found"); // to check keywords in the page.
2nd Jan 2018, 4:20 PM
Calviղ
Calviղ - avatar