I've e across this several times, ctrl-c randomly does not copy. I think it's caused by javascript or maybe some odd html syntax. I never spent the time to track down what caused it. Anyone know the typical/mon causes of ctrl-c not working (to copy) on a website?
Speaking from a developers standpoint. What do we developers end up doing to break ctrl-c?
Just to clarify, I'm not interested in preventing copying. I'm trying to do the opposite, occasionally I find I've done something that is preventing ctrl-c from copying text, and that is not very user friendly on a text heavy site.
To be even more clear, the issue is not with selecting. You can select text just fine. When pressing ctrl-c to copy, it does nothing. I.E. I have text selected, then press ctrl-c and nothing happens.
I've e across this several times, ctrl-c randomly does not copy. I think it's caused by javascript or maybe some odd html syntax. I never spent the time to track down what caused it. Anyone know the typical/mon causes of ctrl-c not working (to copy) on a website?
Speaking from a developers standpoint. What do we developers end up doing to break ctrl-c?
Just to clarify, I'm not interested in preventing copying. I'm trying to do the opposite, occasionally I find I've done something that is preventing ctrl-c from copying text, and that is not very user friendly on a text heavy site.
To be even more clear, the issue is not with selecting. You can select text just fine. When pressing ctrl-c to copy, it does nothing. I.E. I have text selected, then press ctrl-c and nothing happens.
Share Improve this question edited Dec 27, 2010 at 23:32 aepheus asked Dec 27, 2010 at 21:01 aepheusaepheus 8,1978 gold badges38 silver badges51 bronze badges 2- Could you provide an example? – ncuesta Commented Dec 27, 2010 at 21:12
- I cannot provide a web site or specific example. The best I can do is tell the circumstances which this occurs under, usually a specific div will no longer allow ctrl-c to copy text, you can still use copy from the context menu or edit menu. – aepheus Commented Dec 27, 2010 at 21:17
4 Answers
Reset to default 3I've found this sort of thing monly happens when you're trapping keyboard events to provide your own shortcuts and the code behind it is overly greedy. So you intend to give the user a ctrl-U shortcut for making a unicorn appear on the page, but in your event handler, you create a unicorn when ctrl is pressed along with U — but swallow all other events on the page involving ctrl.
I found something here... http://www.brownielocks./stopcopying.html The above link will teach you how to prevent people from right clicking on your website, thus making it more difficult for someone to right click and copy for instance. Please be aware though that there are many ways people can steal content from your site and implementing something like the link above suggests will only prevent the most novice users from making any progress.
Best of luck
It would usually be done on purpose. There's a post on "My Blog Log" that describes a small snippit of javascript that disables copy/paste:
<!-- Disable Copy and Paste-->
<script language='JavaScript1.2'>
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
As far as accidentally breaking ctrl+c, it could be an issue with overlapping content divs in some browsers. With some browsers you can prevent text from being selected entirely by placing an invisible div on top of the content.
Also, if something on the page is listening to key events (javascript or flash) it can interfere with browser hotkeys.
If you use this css, this is the problem!!
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;