user1180567
user1180567

Reputation: 175

Why QWebkit doesn't resolve file:// and qrc:// when used in -webkit-scrollbar css?

Example #1:

::-webkit-scrollbar-button {
    background-image: url(file:///tmp/bg.png);
}

Example #2:

::-webkit-scrollbar-button {
    background-image: url(qrc://bg.png);
}

Above examples are working only when QWebPage shows local html page. For http://stackoverflow.com it doesn't work. I've set the style using QWebSettings::setUserStyleSheetUrl() - it's a user style sheet.

Upvotes: 3

Views: 909

Answers (1)

ramsesoriginal
ramsesoriginal

Reputation: 1920

You have to start Chrome (I'm assuming that's the browser you're using) with the command line flag --allow-file-access-from-files, or else it won't dynamically load local files (using the file:// protocol), as this could be a big security risk.

You can see http://code.google.com/p/chromium/issues/detail?id=4197&can=1&q=allow-file-access-from-files&colspec=ID%20Stars%20Pri%20Area%20Feature%20Type%20Status%20Summary%20Modified%20Owner%20Mstone%20OS for a complete history of this flag, why it behaves like this and why it#s implemented like this.

Upvotes: 1

Related Questions