Click to See Complete Forum and Search --> : disabling brouser MenuItems


santm4u
June 1st, 2004, 06:15 AM
hi,
May i know if its possible to disable the Print MenuItem in IE brouser 6.0,on clicking it dynamically at run time through javascript or java.
Infact i wanna restrict anyone from printing a particular document displayed .

bobo
June 17th, 2004, 10:05 PM
well the real answer is no, you can have the link that leads to this page call up a javascript function like this:


<a href="javascript:;" onClick="open_me()">link</a>

and have this function:
function open_me(){
window.open("your-document.html","","toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=340,height=270,left=100,top=100");
}


this will open you document 100 pixels from the top and 100 from the left with no menu, and will be 340 X 270 .

but still a person only needs to use the "print screen" button and print the content as an image.

so unless you know how to de-activate that button, and the right mouse click,
basically if its on the screen, you can consider it printed already.

Please someone correct me if I'm wrong

bobo
July 1st, 2004, 11:50 AM
lately I was looking at a pdf file with a security option that restricted anyone from printing. But you need Adobe acrobat writter to do this.

The print screen button would still be an issue .

I've restricted users from using the return button (Enter button) in one of my html pages before using javascript .

Onkeypress if key code = 13 (wich means the enter button) return null, if you can do this with print screen button I'm not sure, but you would first need to know the key code for that button. I don't know it if it exist.

bobo
July 9th, 2004, 08:03 PM
I noticed one of my post above carried the width of string, and now people have to scroll to the right to see all of the post.

This must be anoying, this ususally happens when you're at an textarea box using Netscape, and you impliment a long string without any spaces. Then the tables in html wont wrap either because of no spaces. Here is how I fix this.
If anyone cares, or own a forum with the same problem.

On the page where you have the actual <texarea> tag, put this code in the header of the page:




<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function showLines(max, text) {
max--;
text = "" + text;
var temp = "";
var chcount = 0;
for (var i = 0; i < text.length; i++) // for each character ...
{
var ch = text.substring(i, i+1); // first character
var ch2 = text.substring(i+1, i+2); // next character
if (ch == '\n') // if character is a hard return
{
temp += ch;
chcount = 1;
}
else
{
if (chcount == max) // line has max chacters on this line
{
temp += '\n' + ch; // go to next line
chcount = 1; // reset chcount
}
else // Not a newline or max characters ...
{
temp += ch;
chcount++; // so add 1 to chcount
}
}
}
return (temp); // sends value of temp back
}
// End -->
</script>


in the textarea tag I usually call this function onKeyUp, but use whatever works for you. i use onKeyUp because sometimes they're pasting a long string and not typing it.

anyways here's the call:

<textarea name="message" rows="15" cols="35" onKeyUp="this.form.message.value = showLines(50, this.form.message.value)"></textarea>


where 50 is the amount of character before it wraps and message is the name of the textarea tag.

santm4u
July 24th, 2004, 06:10 AM
hi Bobo!
Sorry i am late to thank U for ur effort , but if u say no then what probably could be the wway to restrict anyone printing but only viewing .Are you now knowing the way Acrobat does it?
and does it hold true for other menu items???

bobo
July 24th, 2004, 09:34 PM
You print your file to acrobat writer. (you need acrobat writter installed, not reader) Then you open the file with acrobat writter and when you save it, you have a security option menu. I use acrobat writter alot at work, but never explored or used this security option. The file that I seen using "print security" was not printable when I tried various ways to get around the security to print the document. The print security didn't even go away when I tried saving the file under a new name. Some menus had print greyed out. some didn't, but it didn't matter because none would print the document. In fact I made you one, (pdf file attached) try and print it, if you can let me know how.

Thats about all I know.