Search code examples
javascriptjquerykeyboard-shortcutsctrlkeyword-search

Retrieve CTRL + F Keyword


I'm trying to understand how many users click CTRL+F with jquery script but I want to go deeper and understand which keyword they put into the browser box dialog (or which is highligthed in the web page).

I don't find anything right now.

Anyone can help me on which type of code I have to set up to bring this information? Is it possible or not?

Thanks!


Solution

  • You can't do that, or at least with client side JavaScript. That would be invading users privacy and possibly a security loop-hole in the browsers implementation and even if available it would be patched up very quickly.

    Listening for keystrokes won't work as suggested in the comments because as soon as the user is typing into the find dialogue, the typing is happening outside of the pages focus.

    Conculsion: There is no way to implement such functionality and interact with the browsers native functionality unless exposed by the browsers API.