File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes How to disable CTRL+F Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to disable CTRL+F" Watch "How to disable CTRL+F" New topic

How to disable CTRL+F

Sanjeev Gowda

Joined: May 27, 2005
Posts: 5
Hi all Java Gurus,
I have created a jsp page and i want to disable CTRL+F bcoz when ever any user searches the page through CTRL+F the whole allignment gets changed so i want to disable it or either redirect it and give a alert message that CTRL+F is disabled. Please solce my Query and also tell me where to call the function for disabling or redirecting. As the user can press CTRL+F at any time or any where in the page.
Thanks in Advance
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

Firstly, this has nothing to do with JSP so I'm moving it to the HTML forum.

Secondly, what an incredibly unfriendly thing to do! Why not just fix your code?

[Asking smart questions] [About Bear] [Books by Bear]
Zip Ped
Ranch Hand

Joined: Jul 26, 2005
Posts: 336
You need to capture the keystroke combo and return the javascript function so that the browser action is not taken in the first place.
I agree. Here's the link:
subject: How to disable CTRL+F
jQuery in Action, 3rd edition