onselectstart

Yes, it may make sense and be neccessary to change the normal behaviour of the browser with JavaScript – but please not in way, that the regular use becomes completely impossible!

Some “pros” believe, they can prevent visitors from copying text using constructs like

document.onselectstart=new Function ("return false");

– often in combination with “ondragstart” or “oncontextmenu”.

In fact it is then no longer possible, to select text sections in the displayed document using the mouse, provided that JavaScript is being executed, that the browser supports these event handlers and that you the mouse at all. Unfortunately, the user does not know, why the expected reaction – namely the selection of the text – does not work.

It does not help at all against a copy of the whole text using Ctrl-A and Ctrl+C for example or copying text from the source view (“View” → “Source” or similar). And if the visitor disabled JavaScript – then such pretended “copy protection” does also not work.

Dear web designers: Event handlers, as “onselectstart”, are intended for applications, where the browser should notice, that elements are selected or dragged by the user, for example in an editor of a CMS or an interactive application – and not to twist the regular behaviour of the browser in a way to make certain functions completely unusable!

Dear authors: No, not every visitor wants to misappropriate content, just because he selects parts of the text using the mouse. Maybe someone just wants to look up a term in a search engine – and to be able to select the term in the text makes this much easier.

Leave a Comment

Your email address will not be published. Required fields are marked *