Monday, March 3, 2014

SSRS Reports not Rendering in Chrome, Safari and Firefox?

By default SSRS Reports don't render in Chrome, Firefox and Safari.  However, there is a hack that can be implemented to get this working.

To fix the problem, we need to create a custom stylesheet for SSRS.  The new style sheet will use media queries to target the non-IE browsers.  So, In theory, IE will not be impacted using this solution.  This by no means a perfect solution, and I have not had time to test it in every possible scenario.  However, it has worked for me when I know a user needs to view a report in a non-IE browser.  It works best if you are hyper linking to a report from another location.

For SQL Server 2012,  you will find the SSRS css files located in C:\Program Files\Microsoft SQL Server\MSRS11.[Instance Name]\Reporting Services\ReportServer\Styles.

Create a new css file.  In the file paste the following styles:
@media screen and (-webkit-min-device-pixel-ratio:0) {    div[style] {        overflow:visible !important;    }}@-moz-document url-prefix() {    div[style] {         overflow:visible !important;    }}

Then you will want to take the contents of the HtmlViewer.css file and paste it before the styles above.  From what I can tell, this will tell SSRS to override the entire default css file with the new css file.

In order to call the report with the new css file you will need to use the following url format:
http://[your server dns name]/[Your SSRS Instance Webservice Path]?[Report Path]&rc.StyleSheet=[the new css file name]

where NonIEStylesheet is the name of the css file we placed into C:\Program Files\Microsoft SQL Server\MSRS11.[Instance Name]\Reporting Services\ReportServer\Styles.  Also notice we didn't use the /Reports/ endpoint for SSRS.  We have to use the /ReportServer/ endpoint.