/    Sign up×
Community /Pin to ProfileBookmark

Disable text selection

Hi, how can I disable document text selection in Netscape?

?

Thanks for any help.

Lopez

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@DarkSoulJan 06.2003 — To protect text from being copied?
Copy linkTweet thisAlerts:
@lopezauthorJan 06.2003 — 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
Copy linkTweet thisAlerts:
@DarkSoulJan 06.2003 — I wrote a script for that, it disables a rightclick and keyboard presses (to avoid ctrl +c )

[CODE]<!--

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)";
// -->
[/CODE]


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

[EDIT]onkeypress[/EDIT]
Copy linkTweet thisAlerts:
@lopezauthorJan 06.2003 — Thanks a lot. I will implement it and see how it works.

Lopez
Copy linkTweet thisAlerts:
@Max_Power2Jan 06.2003 — 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.
Copy linkTweet thisAlerts:
@DarkSoulJan 06.2003 — 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.
×

Success!

Help @lopez spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...