Hi I need to disable the option like CTRL+P from my Internet Browser like when the user goes to File menu on Internet Browser and clicks on Print , the action print shud not take place...This thing using java how can we do...
We can't. You might be able to do this with JavaScript, but the user might disable JavaScript.
A general rule of thumb is if you application requires you break the normal operation of another application, you should possibly rethink how your application works. I tend not to visit sites again if they use scripts to change the behaviour of my browser. [ October 17, 2006: Message edited by: Paul Sturrock ]
Originally posted by Paul Sturrock: I tend not to visit sites again if they use scripts to change the behaviour of my browser.
True, if you deviate from the standard flow of operation, user will not be happy.
Think about other options rather then disabling CTL + P � you can display message on the page prompting user that do not use Print option of the browser.
My blood is tested +ve for Java.
Bauke Scholtz
Ranch Hand
Joined: Oct 08, 2006
Posts: 2458
posted
0
More interesting is the question: why do you want do disable printing anyway?
The reason for disabling the Browser option is because lets suppose the browser is displaying some confidential information and the user wants that information on screen but not on paper or print..For eg his signature....Thats why the need is to display the information with every control of browser enabled but restricting the use of any control which might put the information on paper...
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
posted
0
Originally posted by Chapree Mamoo: The reason for disabling the Browser option is because lets suppose the browser is displaying some confidential information and the user wants that information on screen but not on paper or print..For eg his signature....Thats why the need is to display the information with every control of browser enabled but restricting the use of any control which might put the information on paper...
There are many ways to take a print of a webpage
(1)File --> Print (2)Control + P (3)Print Button on Toolbar (4)Right Click --> Print (5)Print Screen --> Paste in Paint --> Print (6)Use HttpClient to make request and print the response (7)��
That is an unmeetable requirement. Suppose my browser told me that I could not print a document and I really wanted to print it its easy to get round my browser trying to stop me. I could turn off JavaScript (assuming the JavaScript is used to prevent printing). I could download the page and open it in some other application. I could view the source and print that etc.
Think about other options rather then disabling CTL + P � you can display message on the page prompting user that do not use Print option of the browser.
True Chetan Parekh. Maybe its just me but when sites do this sort of thing I tend not to visit them twice.
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
posted
0
Originally posted by Paul Sturrock:
True Chetan Parekh. Maybe its just me but when sites do this sort of thing I tend not to visit them twice.
You can't make all the people all the time happy.
Avinash Tiwari
Ranch Hand
Joined: Sep 20, 2006
Posts: 42
posted
0
Lets suppose what's desired is something like this : The signature is in image format and the need is , not in any case let that image appear on print/paper/file. But the pop-up messages saying Print is an invalid option are not to be used.... Then we will have to restrict the options through coding..How will we go about in this case then....
It can't be done. If you make the image publically available it is printable. You can make it difficult to print by trying to break the printing funtionality available in a browser (though as I've pointed out, this won't stop them using an application other than a browser to print the image). If the user is determined enough they will be able to print the image. It does beg the question, if the image is sensitive, why is it being amde publically available at all?
Avinash Tiwari
Ranch Hand
Joined: Sep 20, 2006
Posts: 42
posted
0
Lets say the image is a digital signature..which is required for entering into certain application...but is not required to be printed for security/hacking purposes....
Ernest Friedman-Hill
author and iconoclast
Marshal
Originally posted by Chapree Mamoo: The reason for disabling the Browser option is because lets suppose the browser is displaying some confidential information and the user wants that information on screen but not on paper or print..For eg his signature....Thats why the need is to display the information with every control of browser enabled but restricting the use of any control which might put the information on paper...
Put this information in an unique styled block, for example: class="confidential" and add this to the css:
Then this field will be removed from the view to print. Or, if you don't want to shuffle the layout, then use {visibility: hidden;}
Oh, this doesn't prevent the user from hitting PrintScr, pasting it in a graphic editor and printing it as an image ... [ October 17, 2006: Message edited by: Bauke Scholtz ]