View Full Version : Disabling text selection but not throughout a web page
Dreamkatcha
09-01-2002, 08:47 PM
Hi,
I'm using the following script...
<script language="JavaScript1.2">
//Disable select-text script (IE4+, NS6+)
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
document.onselectstart=new Function ("return false")
//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
...to disable text selection on my web page, but it is causing problems with form fields (an email login box). What I want to be able to do is somehow exclude the login boxes from the effects of the script.
Does anyone know if this is possible? Any help would be greatly appreciated. Thanks. :)
joh6nn
09-01-2002, 10:09 PM
i'm pretty sure it's possible, but i have to wonder why you want it. seems to me that it would drive visitors away
Dreamkatcha
09-01-2002, 10:24 PM
I know, and it would probably put me off too, but the alternative is to have people stealing my content and passing it off as their own. It's happened over and over again so I'm not just being paranoid.
I know these scripts offer very flimsy protection, but they really do work in protecting your site from 90-odd percent of thieves - anyone too lazy to create their own site is usually also too lazy to spend time trying to find workarounds for these gimmicky scripts.
joh6nn
09-01-2002, 10:30 PM
i think that people stealing your content, are more likely be going to using "Save As", than they are to be copying the text.
and you don't need to find a way around the no-highlighting text bit; you just have to hit control+a.
unfortunately, there's really nothing you can do to protect your content. see the following:
http://www.codingforums.com/showthread.php?s=&threadid=4437
Dreamkatcha
09-03-2002, 10:13 AM
The source code is also encrypted so opening the pages in an HTML editor won't work.
I've read dozens of debates like this one and I know how irritating javascript experts find them (sorry to add another one to the collection btw), but even so I don't think these measures are totally worthless.
As long as you accept to begin with that nothing will make your site totally secure you can't go wrong. It doesn't have to be an all or nothing thing. If you can stop the majority of people stealing your content then it's a job well done.
What you've got to remember is that the vast majority of people don't know where to start when they're presented with a few javascript protection gizmos in combination. Rather than putting the time and effort into finding out they go elsewhere, probably to steal food out of people's dustbins - what holds them back in this case is if someone has put the lid on - that totally baffles them. You're dealing with idiots so if you treat them like idiots you can usually get the upper hand.
joh6nn
09-03-2002, 03:05 PM
when dealing with idiots, i do my best to treat them just like i would anyone else. it doesn't get me the upper hand, but it helps me sleep at night.
try the following:
function stopProp(e) {
if ( e.stopPropagation) { e.stopPropagation(); }
else { event.cancelBubble = true; }
}
<INPUT OnMouseDown="stopProp();">
Dreamkatcha
09-03-2002, 05:11 PM
Thanks for the code. How exactly does it work, do you place the code you want to erm un-protect between the } symbol and the imput tag? Sorry for asking stupid question but my javascript knowledge doesn't extend far beyond copying and pasting free scripts.
Don't get me wrong, I don't set out to get one over on anyone whether they're idiots or not. I wasn't generalising, I was just referring to the very specific case of people trying to steal content which I've spent many hours putting together.
I don't think wanting to protect my hard work from thieves makes me a bad person does it?
joh6nn
09-03-2002, 05:23 PM
this part goes in the script tags, with all of the other bits:
function stopProp(e) {
if ( e.stopPropagation) { e.stopPropagation(); }
else { event.cancelBubble = true; }
}
in all of the inputs that you want to be selectable, put this:
OnMouseDown="stopProp();"
i don't know if that will work though.
it's not wrong to want to protect your code. but in my 6 years on the web, to my knowledge, no one who has visited any of my sites, has ever looked at the source, let alone taken it. no one has stolen my one copyrighted image, and even if they have, i have the certificate of copyright, so what do i care?
also, i would never have been able to get into webdesign at all, if i hadn't been able to copy what i saw. if i see something cool, i want to know how it was done. a lot of my early scripts were things i took off other people's pages, pulled apart till they didn't work any more, and then tried to put them back together.
i spent the 3 months from october to december of last year, trying to figure out how to hide or encrypt my source, and found out that in the end, nothing works. nothing is fool proof. and i also found out that it's not worth. the internet doesn't thrive on secrecy. it thrives on openness. the sites that promote sharing code, like this one, look how popular they are. the ones that do things like spy on you with cookies, look how much people hate them. do you know anyone who actually likes bonzai buddy?
you're not a bad person for trying to protect your hard work. but you'll end up getting more credit for sharing it, than you will for hoarding it.
the more i think about keeping my code to myself, the less sense it makes.
saldikey
09-03-2002, 05:32 PM
Originally posted by Dreamkatcha
I know, and it would probably put me off too, but the alternative is to have people stealing my content and passing it off as their own. It's happened over and over again so I'm not just being paranoid.
I know these scripts offer very flimsy protection, but they really do work in protecting your site from 90-odd percent of thieves - anyone too lazy to create their own site is usually also too lazy to spend time trying to find workarounds for these gimmicky scripts.
and then read this
Originally posted by Dreamkatcha
Thanks for the code. How exactly does it work, do you place the code you want to erm un-protect between the } symbol and the imput tag? Sorry for asking stupid question but my javascript knowledge doesn't extend far beyond copying and pasting free scripts.
i was thinking that copyright - does not mean right to copy and hide
Dreamkatcha
09-05-2002, 12:36 PM
Ah, so that's how it's done. Thanks for the explanation, I'll try that now.
You make some excellent points. I can't argue against the sharing philosophy for instance - maybe if I came across reproduced versions of my articles where I'm credited as the author I wouldn't bother going to these lengths, but that very rarely happens. They'll be swiped and with full knowledge of where they originated lazy webmasters will change the copyright notices and slap their own names on them.
What I never seem to be able to convince these people of is that sharing in this case achieves nothing. Say you come across a really useful tutorial and you think it would benefit visitors of your site why wouldn't you just post a message on your board to say here's a tute I found and the URL is blah blah blah? It's because they're not interested in helping people out, all they want to do is claim the credit for something they haven't written. If the goal was to help their visitors the original author would at least be noted in their version of the text. Even so, why would a reproduced article/FAQ/tutorial be any better than the original if it was just copied and pasted? All it does is artifically inflate the content of a site with minimum effort from the webmaster.
I'm not concerned about people using my source code - I quite like the look of my site but in terms of coding it's nothing special. It could be reproduced very quickly just by looking at it in any case. Encrypting the source code is merely a byproduct of 'protecting' the text.
saldikey - I can see how that makes me look like a hypocrite. Thanks for pointing that out. It has never been my intention to use other people's scripts and then hide the copyright information, I just hadn't given it a thought till now because using these scripts and then leaving them in a readable format would be pointless because someone could just come along and take them out.
What I'll do is make a note somewhere on my site that script x was written by author y etc so people can see where they came from without needing to look at the source code. Then I'll be practicing what I preach.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.