Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to detect find on the page searches in javascript

each browser has find on page functionality (ctrl+F). Is there a way to detect user searches in javascript so that I could attach additional actions.

like image 706
Alexander Avatar asked Jul 13 '11 14:07

Alexander


1 Answers

You could do (to detect whenb a user press ctrl+f):

window.onkeydown = function(e){
   if(e.keyCode == 70 && e.ctrlKey){
    //user pressed ctrl+f
}

Fiddle here: http://jsfiddle.net/d8T72/

like image 186
Nicola Peluchetti Avatar answered Oct 22 '22 14:10

Nicola Peluchetti