Please do not report this question as a duplicate. I have seen similar questions on stackoverflow, but they don't answer my specific need.
I have some text selected and highlighted on a web page and I'd like to be able to shift-click away from the selected text without extending the selection of text.
I have created a function that sets the variable shiftkey to true whenever the shift key is pressed and I have another function that gets called on a mouse click. The latter function tests if the shiftkey var is set to true to determine if I have a shift-click event. If so, I thought e.preventDefault(); would prevent extending the selected text, but it doesn't!
Using
document.getElementsByTagName("body").style.userSelect = "none";
followed by
window.getSelection().toString();
and finally
document.getElementsByTagName("body").style.userSelect = "auto";
doesn't work either!
Any ideas how this can be made to work?