I was wondering if there was a way to prevent a web page from being highlighted when holding the shift key and clicking anywhere on the browser (this happens in Safari, not sure if it does on any other website), I would like to prevent this from happening in Safari. If it works on the browsers that’s a plus.
Go ahead and try it on this page. Hold shift and click anywhere. See the highlighted portion? YUCK!! Any help would be much appreciated! thanks in advance!
here’s the layout of my HTML page
<html>
<body>
<div id="content">
<!---- Some random stuff ----->
</div>
</body>
</html>
Firstly, I should tell you this probably isn’t a good idea because users expect this basic website functionality to be consistent and always work. Just because you think it is yuck, doesn’t mean everyone does.
With that out of the way, you will want to add some CSS, use
user-select: none;, typically with all the usual vendor prefixes such asmoz,webkit,o, etc.jsFiddle.
Further Reading.