Unsolved How to disable user-text-selection without using CSS Stylesheet?
-
I am using the QtWebengine in Version 5.9.4 based in Chromium 56.
I've tried to find an option to disable the text selection on html pages in the source code of my QT Project, but I did not found any option to do this.
I know the option, using CSS Stylesheets, but this is no possible solution for my project because the customers often implements this option not in their sourcecode stylesheets and don't want to change it afterwards.
Is their any possibility to change this behavior in the QtWebEngine Framework or do I need to find a solution on the Chromium based source code?
-
@SteKo_dev
you can still include a default stylesheet (transparent for each user) - independently for the page loaded.
See this example. -
With your help,I found a solution to do that, but in my opinion its really dirty to inject code to a customer html document.
It works for the first moment, but I’d like to find a solution without injecting code to a customer page.
See code below.
WebEngineView.runJavaScript("var head = document.head;" + "var node= document.createElement('style');" + "var textnode = document.createTextNode('body {-webkit-user-select: none !important;}');" + "node.appendChild(textnode);head.appendChild(node);" ,function(){/*Empty function for callback*/})
Is there any possibility to change it in the chromium based source code by default ?
-
@SteKo_dev said in How to disable user-text-selection without using CSS Stylesheet?:
Is there any possibility to change it in the chromium based source code by default ?
i would say THAT is the dirty way actually. You would have to make the change for every release?!
I don't see why the injection should be dirty in your opinion. Thats actually pretty normal in Web 2.0 to dynamically inject content into a webpage.