Have you ever had to use the Report Server in Firefox? If you did it, you noticed that there is a problem with the display of the report viewer in that browser.

Basically, the problem is because initially the browser loads the default size of the report viewer control. Once the data is loaded, the browser doesn’t resize it.

To solve it, you can install a plug in, which can be downloaded from MS Report Server Fixes. The problem with this solution is that you have to install it in each computer that will accesses the report server.

But you can take the great idea of Jim Wilson and implement it in your report viewers control. In my case I improved the code to give a better layout:

  <script type="text/javascript">
      function Load() {
          if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
              if (document.getElementsByTagName('iframe').length) {
                  // Add a new style node to make sure all iframes are affected - even those not yet in the DOM.
                  var style = document.createElement('style'); 
              if (document.getElementsByTagName('style').length) {
                  // Grab the inline style element and filter out bad values.
                  var styles = document.getElementsByTagName('style');
                  for (var i = 0; i < styles.length; i++) {
                      var style = styles[i];
                      style.innerHTML = style.innerHTML.replace(/overflow-x:hidden;?/, '');
          document.getElementById('ReportFramectl146').style.width= document.documentElement.clientWidth;  
         document.getElementById('ParameterTable_ctl146_ctl00').style.width= document.documentElement.clientWidth;  
         document.getElementById('oReportDiv').style.width= document.documentElement.clientWidth;

 Then, call the function in the page load event. For instance:

<body style="margin: 0px; overflow: auto" onload="Load()">

I already fixed it in the Report Manager and the Report Server. You can download the following files and overwrite them in their respective folders of your server:

Report.aspx to be pasted in C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\Pages

ReportViewer.aspx to be pasted in C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportManager\Pages

So, now you’ll see the reports properly in Firefox.


[1] Jim Wilson, http://userscripts.org, 2006

[2] Sergio Tarrillo, http://geeks.ms/, 2008


Post a Comment