/    Sign up×
Community /Pin to ProfileBookmark

Disable Text Selection script query

In the latest newsletter, there’s a script to disable text placed between “div” and “/div” marked as “content” for the purposes of the script.

This works very well if you actually just try to copy the text but, even if you make the whole page the “content”, if you simply right click in the page and “select all” you can grab the text anyway to copy to wordpad or something.

Is there a script which can diable that function too? Or maybe just the right click?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceFeb 12.2006 — You can try this:
<i>
</i>&lt;script type="text/javascript"&gt;
&lt;!--//
if (window.Event)
document.captureEvents(Event.MOUSEDOWN);
function noRightClick(evt) {
if (window.Event) {
if (evt.which==2 || evt.which==3) {
return false;
}
}
return true;
}
document.onmousedown = noRightClick;
function noContextMenu(evt) {
if (window.Event) {
evt.cancelBubble = true;
evt.returnValue = false;
} else {
event.cancelBubble = true;
event.returnValue = false;
}
return false;
}
document.oncontextmenu = noContextMenu;
//--&gt;
&lt;/script&gt;
Copy linkTweet thisAlerts:
@JSchofauthorFeb 12.2006 — Many thanks - I'll give that a go. Probably still can't disable "select all" in browser and then Ctrl_C to copy but anything to slow them down or put off the casual copier!!
Copy linkTweet thisAlerts:
@KravvitzFeb 12.2006 — Things like that only annoy people. Any one with the right skills or who is determined will be able to copy content from your site. The only way to protect your content is to not put it on the WWW in the first place.
Copy linkTweet thisAlerts:
@felgallFeb 12.2006 — Once they view the source of your web page they can copy all of the content regardless of what "proterction" you might have built into the page.
Copy linkTweet thisAlerts:
@JSchofauthorFeb 12.2006 — yes - I know all that guys. Been there before. Just niggles me so I'll niggle them back!
×

Success!

Help @JSchof 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.25,
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,
)...