문제

I'm working on a desktop application that builds its interface in Chromium Embedded Framework. I need to disable text selection so the user can't drag over text (in a <p> or <a> tag) to select it. Selecting text in desktop applications is not normal, so this is important for our application as well. I am currently using CSS to disable text selection and JavaScript to override Ctrl + A, but I'm looking for a lower level way to directly disable it with the CEF application. Is this possible?

도움이 되었습니까?

해결책

Quick CSS solution like next, also preventing selection via keyboard shortcuts (Ctrl+A):

* {
    -webkit-user-select: none;
}

You just did not disable selection to all you elements (some of them still selectable).

I'm did not think that CEF3 currently has any low level solution to prevent text selection. And there is bad idea at all - you pages can contain content editable elements which want selection, so controlling it via CSS looks more flexible.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top