[SalesForce] Visualforce: Major grief with IE9 AJAX refresh/rerender issues

Friends,

I have a VF page which is part of a customer portal. This page displays records from custom object in a Apex:DataTable. I have added pagination with Prev,Next,First,Last links to enable users to navigate through records.

The data is obtained by a SOQL query using the latest OFFSET feature. Everything is fine with this.

I did most of the development in Firefox as I love the CSS and dev tools it has. Everything worked fine. I tested in Chrome and it was fine. Last was IE9 which defying logic is still the most popular browser out there.

IE displays the page well. But has major issues with the pagination functionality.
Clicking the Prev, Next buttons will work for maybe 5-8 clicks and then it starts freezing up and finally stops working altogether. Since the table has to be re-rendered, I knew this has to be the dreaded AJAX issues that VF seems to have with IE9.

I tried this again with the Javascript console and sure enough when it froze, I got this error.

SCRIPT87: Invalid argument. 
3_3_3.Finalorg.ajax4jsf.javascript.AjaxScript?rel=1359595794000, line 146 character 96

Screenshot:

I tried searching online and found a few similar posts addressing the AJAX refresh issue.

None of this seems to help. Running in IE7,IE8 compatibility also does not seem to help.

The Apex:form is within the <body> tag.

These solutions may or may not help you. They did not work for me.

http://success.salesforce.com/issues_view?id=a1p30000000RduwAAC

http://boards.developerforce.com/t5/Visualforce-Development/IE9-rerender-and-iframes-don-t-work/td-p/260459

AJAX communication on visualforce > Internet Explorer 8/9 issues

How can I resolve this issue as this is required to work properly on IE9.
Please let me know if you need other information from me.

Thank you very much in advance.

Best Answer

Actually I found the solution finally.

Thanks to this guy's post in the developer forums. http://boards.developerforce.com/t5/Visualforce-Development/actionFunction-causing-Javascript-error-when-using-oncomplete-or/m-p/193724#M25961

The key was to override the Javascript function in question and add a try/catch block to ensure IE does not terminate the running code.

A4J.AJAX.XMLHttpRequest.prototype._copyAttribute = function (src, dst, attr) {
var value = src.getAttribute(attr);
if (value) {
    try {
        dst.setAttribute(attr, value);
    } catch (err) {
        //alert('Error with Salesforce: ' + err.description + '\nattr: ' + attr + '\n');
    }
}

};

I hope this helps someone who runs into this same issue with IE9.

Related Topic