In google docs, if you press Ctrl+F, the browser will not pop up the “Find” dlg, but the google docs will get this event, how to make it technology?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I’ll hazard a guess that they bind an event listener that fires when a key is pressed. If F and Ctrl are pressed (see
charCode,keyCode, andctrlKey) then they canevent.preventDefault()— preventing the browser-default “Find” interface — and instead render their own in-browser “Find” UI.Of course, this wouldn’t be fun without the usual hodgepodge of browser inconsistencies. That means if you’re taking the (strongly not recommended) no-library route, you might want to read up on the differences on Quirksmode.