iOS browser disable copy but highlight text CSS/Javascript
I have been successful at disabling the ability to highlight text in Safari on iOS using:
-webkit-user-select: none;
However, I do want to be able to highlight the text. I only don't want the copy box to show up.
Is there any way I can do this?
You could try disabling right click along with ctrl+c. Here is a javascript method for disabling right mouse clicking:
<script type="text/javascript">
function catch_click(e)
{
if (!e) var e = window.event;
var right_click = (e.which ? (e.which == 3) : (e.button == 2));
if (right_click)
{
alert('Right clicking on this page is not allowed.');
return false;
}
}
document.onmousedown = catch_click;
if (document.captureEvents) document.captureEvents(Event.MOUSEDOWN);
</script>
And here is one in jquery that disable copy/paste:
$(document).ready(function () {
$('#Selector').bind('copy paste', function (e) {
e.preventDefault();
});
});
So basically allow users to select the field but disable ways of copying it.
链接地址: http://www.djcxy.com/p/72742.html