Y2Z / Liquid

:ocean: Turn websites into desktop applications
Creative Commons Zero v1.0 Universal
19 stars 1 forks source link

Additional CSS doesn't work on kernel.org #55

Open snshn opened 2 years ago

snshn commented 2 years ago

Error message:

js: Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-37Qv0ESIAHC7q5kW3AjdcNW/glH9Aix+J0H5hiCl7VM='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.

snshn commented 2 years ago

Possible solution:

static const QString js = "'undefined' != typeof document.styleSheets && 0 < document.styleSheets.length && document.styleSheets[0].addRule('::-webkit-scrollbar', 'width: 0 !important; height: 0 !important', 0);";

page()->runJavaScript(QString(js), QWebEngineScript::ApplicationWorld);