SSRS 2008 R2 - SSRS 2012 - ReportViewer: Reports in Safari/Chrome but works fine in Firefox/Internet Explorer 8... why?

I have some simple reports in SSRS 2008 R2, but they won't display at all in Safari or Chrome. According to Microsoft's Books Online, these browsers are supported in limited fashion. However, I can't see anything after the data "Loading" clock completes. The parameter bar and bread crumb navigation section at the top of the page are all there. Also, I can Save/Export to any format on Safari and Chrome. It just won't display the report section itself, which is just blank.

Am I supposed to use certificates and secured connections (currently not setup with HTTPS, only HTTP)? Are there any server-side configurations that need to be tweaked? Has anyone had success displaying ANY reports on Safari/Chrome using previous SSRS versions (2005)?

I'm using Safari 5.0.4 and Chrome 10.0.648.151. I know the similarity for these two browsers is they both are based on WebKit.

The report renders successfully on Internet Explorer 8 (of course) and Firefox 4.0.

I would really appreciate it if someone can shed some light on this.


Ultimate solution (works in SSRS 2012 too!)

Append the following script to "C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js" (on the SSRS Server):

function pageLoad() {
    var element = document.getElementById("ctl31_ctl10");
    if (element)
    {
        element.style.overflow = "visible";
    }
}

Actually I don't know if the div's name is always ctl31_ctl10: in my case it is (instead over SQL Server 2012 azzlak found ctl32_ctl09).

If this solution doesn't work, look at the HTML from your browser to see if the script has worked properly changing the overflow:auto property to overflow:visible.


Solution for ReportViewer control

Insert this style line into the .aspx page (or into a linked .css file, if available):

#reportViewer_ctl09 {
  overflow:visible !important;
}

Reason

Chrome and Safari render overflow:auto in different way respect to Internet Explorer.

SSRS HTML is QuirksMode HTML and depends on IE 5.5 bugs. Non-IE browsers don't have the IE quirksmode and therefore render the HTML correctly

The HTML page produced by SSRS 2008 R2 reports contain a div which has overflow:auto style, and it turns report into an invisible report.

<div id="ctl31_ctl10" style="height:100%;width:100%;overflow:auto;position:relative;">
...</div>

Changing manually (using Chrome's debug window) final HTML overflow:auto in overflow:visible i can see reports on Chrome.

I love Tim's solution; it's easy and working.

But there is still a problem: Any time the user change parameters (my reports use parameters!) AJAX refreshes the div, the overflow:auto tag is rewritten, and no script changes it. This technote detail explains what is the problem.

This happens because in a page built with AJAX panels, only the AJAX panels change their state, without refreshing the whole page. Consequently, the OnLoad events you applied on the tag are only fired once: the first time your page loads. After that, changing any of the AJAX panels will not trigger these events anymore.

Mr.einarq suggested me the solution here.

Another option is to rename your function to pageLoad.

Any functions with this name will be called automatically by ASP.NET Ajax if it exists on the page, also after each partial update. If you do this you can also remove the onload attribute from the body tag

So I wrote the improved script that is shown in the solution.


CSS-based Solution

I was able to add the following to the stylesheet for Reporting Services, and it fixed it for me in Chrome.

Disclaimer: This isn't thoroughly tested for cross-browser compatibility.

/**************CHROME BUG FIX*****************/
div#ctl31_ctl09,
div#ctl31_ctl10
{
    overflow: visible !important;
}
/*********************************************/

Add that to the beginning of the ReportingServices.css file.

For me, that file is located at:

C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\Styles\ReportingServices.css


This is a known issue. The problem is that a div tag has the style "overflow: auto" which apparently is not implemented well with WebKit which is used by Safari and Chrome (see Emanuele Greco's answer). I did not know how to take advantage of Emanuele's suggestion to use the RS:ReportViewerHost element, but I solved it using JavaScript.

Problem

enter image description here

Solution

Since "overflow: auto" is specified in the style attribute of the div element with id "ctl31_ctl10", we can't override it in a stylesheet file so I resorted to JavaScript. I appended the following code to "C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportManager\js\ReportingServices.js"

function FixSafari()
{    
    var element = document.getElementById("ctl31_ctl10");
    if (element) 
    {
        element.style.overflow = "visible";  //default overflow value
    }
}

// Code from https://stackoverflow.com/questions/9434/how-do-i-add-an-additional-window-onload-event-in-javascript
if (window.addEventListener) // W3C standard
{
    window.addEventListener('load', FixSafari, false); // NB **not** 'onload'
} 
else if (window.attachEvent) // Microsoft
{
    window.attachEvent('onload', FixSafari);
}

Note

There appears to be a solution for SSRS 2005 that I have not tried but I don't think it is applicable to SSRS 2008 because I can't find the "DocMapAndReportFrame" class.


CSS-based system-wide solution

This doesn't require any JavaScript or Ajax frames or any other wrapper. It was tested on Internet Explorer, Firefox, Safari and Chrome.

This can be fixed at the Style Sheet level in Report Server.

First, navigate to the directory where reporting services is installed, in my case (SQL Server 2012 SP1) it is:

C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer

In that directory, you will find a file named reportserver.config.

See Customize Style Sheets for HTML Viewer and Report Manager.

In that file insert a single XML line like (from the above document):

<Configuration>
...
          <HTMLViewerStyleSheet>SafariChromeFix</HTMLViewerStyleSheet>
...
</Configuration>

Save that.

What they don't tell you in the above link is that this entry overrides the default style sheet completely. My first attempts to get the reports to render worked by adding a div stylesheet, everything else was broken. Once I figured out that this edit to the reporserver.config file didn’t augment, but actually replaces the default style sheet, I copied in the default style sheet and everything started working.

Next, descend into the Styles directory (C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\Styles).

Make a copy the file named SP_Full.css and name the copy SafariChromeFix.css. At this point, SafariChromeFix.css should be identical to SP_Full.css.

Edit SafariChromeFix.css and add the following lines to the top:

div {
    overflow: visible !important;
}

Save it.

Once this is saved, all of the existing reports on this instance of Reporting Services will render on all browsers including Chrome and Safari.

Please Note:

It’s not only possible, but extremely likely that reportserver.config will be overwritten with updates to reporting services, so you may have to add the <HTMLViewerStyleSheet>SafariChrome</HTMLViewerStyleSheet> tag into it over time.

This also gives us a place to break into the default style sheet and make a lot of other custom changes starting from something that is already working. And since it's not the default stylesheet, your new custom CSS file doesn't get overwritten during upgrades and patches.


In my case the offending DIV is "ctl31_ctl09" so if the above solution doesn't work for you try changing var element = document.getElementById("ctl31_ctl10"); to var element = document.getElementById("ctl31_ctl09");