How to specify the path of custom style sheet?

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

How to specify the path of custom style sheet?

Postby shenhui » Tue Apr 19, 2011 8:26 pm

Hello all,

I have another question, how do I initialize the value of user_style_sheet_location in CefBrowserSettings, I initialized like this:

Code: Select all
CefSettings setting ;
CefBrowserSettings browserDefaults ;
browserDefaults.user_style_sheet_enabled = true ;
browserDefaults.user_style_sheet_location.str = new TCHAR[MAX_PATH] ;
_tcscpy(browserSettings.user_style_sheet_location.str, file:///H://20110411//cef_binary_r181_VS2005-VS2008//build//Release//style.css) ;
CefInitialize(setting, browserDefaults) ;


But it does not work, the style.css seems not loaded into CEF object. Do I need to do anything else ?

Thanks for your advice.
shenhui
Techie
 
Posts: 31
Joined: Sat Apr 16, 2011 10:50 pm

Re: How to specify the path of custom style sheet?

Postby magreenblatt » Wed Apr 20, 2011 9:01 am

I doubt that the code you posted will compile. Try this instead:
Code: Select all
CefSettings setting ;
CefBrowserSettings browserDefaults ;
browserDefaults.user_style_sheet_enabled = true ;
CefString(&browserSettings.user_style_sheet_location).FromASCII(
    "file:///H:/20110411/cef_binary_r181_VS2005-VS2008/build/Release/style.css");
CefInitialize(setting, browserDefaults) ;
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: How to specify the path of custom style sheet?

Postby shenhui » Thu Apr 21, 2011 6:22 am

Hello magreenblatt,

I have tried your code and the result is the same.
Have you ever taken a try on this function ? It seems the user_style_sheet_location does not work, the .css file was not loaded by CEF.

Hope for your reply.

Thanks.
shenhui
Techie
 
Posts: 31
Joined: Sat Apr 16, 2011 10:50 pm

Re: How to specify the path of custom style sheet?

Postby magreenblatt » Thu Apr 21, 2011 6:57 am

Other people have claimed that user style sheets work. You should build CEF and Chromium from source code and debug why they aren't working for you.
magreenblatt
Site Admin
 
Posts: 12383
Joined: Fri May 29, 2009 6:57 pm

Re: How to specify the path of custom style sheet?

Postby shenhui » Thu Apr 21, 2011 8:16 am

Got it. Thanks a lot.
shenhui
Techie
 
Posts: 31
Joined: Sat Apr 16, 2011 10:50 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 20 guests