0

We are having an issue with our web application (JSF 1.2 + Ajax4jsf 1.1 ) .We get the following error

**Message: Permission denied
Line: 27
Char: 222
Code: 0
URI: http://uat.example.com/ABC/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.jsf**

This problem is sporadic and happens 50% of the times. Happens only on IE8 in all other browsers we do not see this problem. When this error occurs the whole page blanks out. Howevere a Refresh brings the page back.

We did go through couple of articles regarding IE QUIRK VS standard mode. Force IE8 Into IE7 Compatiblity Mode Did not help.

NOTE: This is not cross site scripting issue as the domain where the script (generated by JSF ) is the same domain where our app is installed.

Please let us know if some has solved this issue. I see a similar problem posted by some one at http://www.coderanch.com/t/490213/JSF/java/support-IE

Community
  • 1
  • 1
Reddymails
  • 793
  • 1
  • 10
  • 24

1 Answers1

1

Found the fix to the problem.Fixed by modifying ajax4jsf-1.1.0.jar

Root cause: In case of IE-8 the response is being fetched from Ajax object though the response is not read yet. So we added fix for IE by checking the status==200 and readystate=4.

Here is what we did Open AJAX.js which is under \org\ajax4jsf\framework\ajax\scripts\AJAX.js inside the jar

STEP 1. Change from:

    getResponseText : function(){
       return this._request.responseText;
   }

TO:

    getResponseText : function(){
    if (this._request.readyState == 4){
        if (this._request.status == 200) {
            return this._request.responseText;
        }
    }
}

STEP 2. Looks for this method and change FROM:

     window.setTimeout(function() {
    var isDocOpen=false;
    //This functions has few more lines , I have not pasted all code here...

Change TO:

    //This is the Fix for IE....The isIE variable is pre defined inside the script.
    if (isIE){
 if (req.readyState == 4){
    if (req.status == 200) {
        window.document.open(req.getContentType(),true);
        isDocOpen=true;

        window.document.write(req.getResponseText());
        window.document.close();
    }
  }
    } 
    else {
    //This is the Original code...
    //Keep this for all other browsers...
    window.document.open(req.getContentType(),true);
     isDocOpen=true;
      window.document.write(req.getResponseText());
   window.document.close();
   }

....... Rest of the code should follow as on Original script.

STEP 3:

    //COMMENT OUT THIS ORIGINAL CODE. Not sure why this reloading is done for IE
    //this was causing IE to send requests...more than once..   
    //if(isIE){
/ For Ie , scripts on page not activated.
//  window.location.reload(false);
//}

Once we made the above change , we used win rar and dropped the Ajax.js file back to ajax4jsf-1.1.0.jar and now IE 8 pains got resolved.

Hope it helps someone out there.

messivanio
  • 2,263
  • 18
  • 24
Reddymails
  • 793
  • 1
  • 10
  • 24