Click to See Complete Forum and Search --> : Disable text selection


lopez
01-05-2003, 09:03 PM
Hi, how can I disable document text selection in Netscape?

:confused:

Thanks for any help.

Lopez

DarkSoul
01-05-2003, 11:29 PM
To protect text from being copied?

lopez
01-05-2003, 11:43 PM
That's right. I have a page with some text that shouldn't be copied or printed. How can I do this?

Thanks for any help.

Lopez

DarkSoul
01-05-2003, 11:51 PM
I wrote a script for that, it disables a rightclick and keyboard presses (to avoid ctrl +c )

<!--

var message="Rightclick message";
var message2="Keypress message";


function Key(){
alert(message2);
window.location.reload(); /* clear the ctrl cache,if they're REALLY trying hard */
}

function click(e){
if(document.all){
if(event.button==2){
alert(message);
return false;
}
}
if(document.layers){
if(e.which==3){
alert(message);
return false;
}
}
}
if(document.layers){
document.captureEvents(Even.MOUSEDOWN);
}
document.onmousedown=click;
document.all.onKeyPress="alert(message2)";
// -->


The prob is, that if you have onkeypress events on that page (not if it's a single frame the script is running on) it will capture those too.
It's the best I *can* do
onkeypress

lopez
01-06-2003, 12:01 AM
Thanks a lot. I will implement it and see how it works.

Lopez

Max^Power
01-06-2003, 02:36 AM
if you have any text that you don't want anyone to have, i would recommend that you dont put it on your webpage at all, because although the above script may keep some people away from taking your text, there are still other ways to bypass that script and people will take your text the same.

DarkSoul
01-06-2003, 02:46 AM
I know, (while testing the script, I've found several ways to bypass it)

But, I dunno who I'm qouting: "90% of computer users only know 10% of the functions that come with the programs they're using."
With that in thought it would be "okey enough in general"

but indeed, if you really wouldn't want someone to copy, download or in any way dupiclate something, you schouldn't put it online at all.