Wednesday, February 22, 2012

The Safari’s and Chrome’s problems with Report Viewer 2010 + UpdatePanel + SharePoint 2010 or Uncaught Sys.ScriptLoadFailedException: Sys.ScriptLoadFailedException: The script '.....' could not be loaded. Uncaught TypeError: Cannot read property '_notified' of null.

Initial data
We have one WebPart for the  SharePoint 2010. In this WebPart we have one UpdatePanel. In this UpdatePanel  -  Microsoft Report Viewer 2010 is placed.

MS Report Viewer  works correct in the IE9.0 and in the Firefox. Report’s data being displayed correctly… But in the Chrome and in the Safari we have nothing.  Well, we see NOT active Report Viewer, without any content.  But if we remove UpadtePanel – all works  good in all browsers. I was trying to reproduce this issue by base website created in the VS2010 (UpdatePanel + Report Viewer) – and again all was good. There was not any problems.  But in the SharePoint2010 – no data in the ReportViewer.

By the Chrome Dev Tool (F12) I found that the page had two JavaScript’s errors :
  1. Uncaught Sys.ScriptLoadFailedException: Sys.ScriptLoadFailedException: The script '....' could not be loaded. 
  2. Uncaught TypeError: Cannot read property '_notified' of null
And it was in the MicrosoftAjaxWebForms.js...

After internet’s revision I found that the same errors often occur in these browsers ( Safary and Chrome) if you use UpdatePanel/AjaxToolkit – all that uses  ScriptManager. MicrosoftAjax in one word… it looks like the problem is in the following - MicrosoftAjaxWebForms.js don't define WebKit browsers correctly
If you add following code on the page - all works correctly :

Sys.Browser.WebKit = {};
if (navigator.userAgent.indexOf('WebKit/') > -1) {
    Sys.Browser.agent = Sys.Browser.WebKit;
    Sys.Browser.version = parseFloat(navigator.userAgent.match(/WebKit\/(\d+(\.\d+)?)/)[1]); = 'WebKit';

It looks like that correct JavaScript is present for these browsers, but definer is not present.  In any case these rows were solving my problems. But one question still present - why it was in the SharePoint2010 and was not present in the simple website created by VS2010… only one suggestion - different versions of the scripts for these products.

Hope it will help you.