I wanted more control on how my CSBlog page displays for Firefox and IE-based browsers so I added the ability to load a specific CSS file in Community Server based on the browser type. So IE, Maxthon and other IE-variants will use style.css, Firefox (and Netscape) browsers will use a style_gecko.css stylesheet.
First I added a browsercaps area in the blog web.config. That code is here.
Then added my own utilities class in a new CommunityServer.DBVT namespace containing the CheckIsGecko() method.**
public static bool CheckIsGecko()
{
return "gecko" == HttpContext.Current.Request.Browser.Browser.ToLower() &&
HttpContext.Current.Request.Browser.MajorVersion >= 1;
}
Then updated the Style.cs class in the CommunityServer.Blogs.Controls namespace.
if (Utilities.CheckIsGecko())
writer.WriteLine(styleFormat,CSSPath(weblog.Theme,"style_gecko.css"),"screen");
else
writer.WriteLine(styleFormat,CSSPath(weblog.Theme,"style.css"),"screen");
** I didn't plan having to concern myself this early on with writing mods in such a way so I don't lose them on future CS upgrades. But it will be important to document and isolate code updates as much as possible.