Patching RichFaces 3.3.3 AJAX.js for IE9

There are always some problems when working with 3rd party frameworks when the world moves forward but the framework you’re using doesn’t. After JSF 2 was released the RichFaces development moved to 4.x version and they dropped support for the older versions although many users are still using the older versions as it’s not trivial or free to update to JSF 2 & RichFaces 4. Now if users have problems with the older versions they just have to patch it themselves as the RichFaces team isn’t going to fix e.g. the IE9 issues.

The problem with Internet Explorer 9 is that with RichFaces 3.3.3.Final the Ajax components doesn’t work and there are errors shown in the JavaScript Console. For example when testing RichFaces Ajax demos the JavaScript is assigning A.outerHTML = new XMLSerializer().serializeToString(C) which gives the following error:

SCRIPT16386: No such interface supported

Fortunately it’s relatively easy to fix it for IE9 by patching the AJAX.js JavaScript file in RichFaces. The process is discussed in RichFaces’s RF-9485 -JIRA ticket and JBoss forum message. In short the patching for AJAX.js contains following steps.

Update 2013-06-13: If you want quick solutions and aren’t interested about how it’s done, you can get the patched AJAX.js from the RF-9485 ticket as Ken Clubok pointed out in the comments.

Upgrading Sarissa Framework and patching RichFaces AJAX.js file


1) Instead of patching Sarissa as suggested in the ticket it’s better to upgrade Sarissa to as it has some additional IE9 issues fixed.

Download Sarissa:

Extract sarissa.js from the jar:

Replace first part of AJAX.js (till EOF comment) or replace sarissa.js in richfaces souce resources.
richfaces-impl-3.3.3.Final.jar/org/ajax4jsf/javascript/scripts/AJAX.js or richfaces-ui-3.3.3.Final\framework\impl\src\main\javascript\ajaxjsf\

2) For richfaces-impl work in non-compatibility mode in IE9, A4J.AJAX.replacePage method should be fixed in RichFaces sources in AJAX.js or JSFAJAX.js because custom method does not work in IE9 document mode.

Replace (line 2125 in AJAX.js, line 1121 in JFSAJAX.js)
	if(isIE) {  
	if(isIE&&!Sarissa._SARISSA_IS_IE9) { 

3) You will also need to change or comment the next line in AJAX.js or JSFAJAX.js (richfaces-ui-3.3.3.Final\framework\impl\src\main\javascript\ajaxjsf\)

Replace (line 2119 in AJAX.js, line 1044 in JFSAJAX.js)
	LOG.debug("Hidden JSF state fields: "+idsSpan);
	LOG.debug("Hidden JSF state fields: ");//+idsSpan);

Otherwise you get the following error in IE9:

	SCRIPT438: Object doesn't support this property or method
	For this line 2648 in framework pack:
	LOG.debug("Hidden JSF state fields: "+Q);

4) Now you have patched AJAX.js and you can either build a new RichFaces Jar, replace the original AJAX.js in RichFaces Jar with the patched one or just override it in your html.

The easiest way is just include the patched AJAX.js file as the last script-include within HEAD and it will take control over the bundled version of RichFaces.

In your template.jspx or similar:


5) Done.

Other ways to fix IE9 compatibility issues has been discussed in tickets RF-10774 as forcing IE9 to use another document mode. Also suggested solutions are to implement a browser sniffer and tell the Sarissa library to use its own XMLSerializer when Internet Explorer 9 is detected and forcing IE9 to run in an emulated mode but neither of those worked for me.





13 responses to “Patching RichFaces 3.3.3 AJAX.js for IE9”

  1. MPA Avatar

    Works perfectly, you save my day! thaks!

  2. Chaina Avatar

    This solution works great with IE9,but in IE10 the editor content are not getting formatted and wjat ever style i apply to it is not getting rendered,help me out on thus

    1. Marko Avatar

      Have you tried the solutions shown in

      Anyways, soon the support of IE 9 and IE 10 will end and the future is in IE 11 so I wouldn’t but much effort to fix old framework issues with deprecated browsers.

  3. […] of years ago I wrote about patching RichFaces 3.3.3 AJAX.js for IE9 and as the browser world has moved on, it’s now time to patch RichFaces 3.3.3 AJAX.js for […]

  4. sarfaraz Avatar

    Hi after implementing the patch- new XMLSerializer().serializeToString(C) is giving me “undefined” value. please help.

    1. Marko Avatar

      The RichFaces 3.3.3 Sarissa patch doesn’t fix all the issues with IE 9. In the JBoss forum thread there are some discussions about the situations which are still broken.

  5. Prasanna Avatar

    Its Works good thanks ……..

  6. Ken Clubok Avatar

    While these instructions are easy to follow, an even easier option is available. The JIRA has the patched AJAX.js file attached. So you can simply replace the file, without doing the manual edits. The patched file can be downloaded here:

    1. Marko Avatar

      Yeah, I should have written it to the post that the RF-9485 ticket has the patched AJAX.js as an attachment.

    2. Naveen Chand Jampala Avatar
      Naveen Chand Jampala

      Its Working with the Browser Mode in IE9 but not with any other modes like IE9 Compatibility Mode,IE8..etc

      1. Naveen Chand Jampala Avatar
        Naveen Chand Jampala

        Can You please help me on this..

      2. Marko Avatar

        I finally got time to test it myself and didn’t notice any problems with IE9 compatibility view. I don’t have IE 8 available but Sarissa script checks for the IE9 so it should work also in IE 8. You can also disable the patch for other browser than IE 9 with conditional comments like < !–[if lt IE 9 ]>

        Have you tried asking from the JBoss forum thread concerning this issue?

  7. Iogui Avatar

    Thanks man, it works like a charm!

Leave a Reply

Your email address will not be published. Required fields are marked *