0

我们的 Web 应用程序(JSF 1.2 + Ajax4jsf 1.1)出现问题。我们收到以下错误

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

这个问题是零星的,发生率为 50%。仅在所有其他浏览器中的 IE8 上发生,我们看不到此问题。发生此错误时,整个页面将变为空白。但是,刷新会使页面返回。

我们确实浏览了几篇关于 IE QUIRK VS 标准模式的文章。 强制 IE8 进入 IE7 兼容模式 没有帮助。

注意:这不是跨站点脚本问题,因为脚本(由 JSF 生成)所在的域与安装我们的应用程序的域相同。

如果有人解决了这个问题,请告诉我们。我看到有人在 http://www.coderanch.com/t/490213/JSF/java/support-IE上发布了类似的问题

4

1 回答 1

1

找到了问题的解决方法。通过修改ajax4jsf-1.1.0.jar来修复

根本原因:在 IE-8 的情况下,响应是从 Ajax 对象中获取的,尽管响应尚未读取。因此,我们通过检查 status==200 和 readystate=4 添加了 IE 修复。

这是我们所做的 打开 AJAX.js,它位于 jar 内的 \org\ajax4jsf\framework\ajax\scripts\AJAX.js 下

步骤 1. 更改:

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

至:

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

STEP 2. 寻找这个方法并改变从:

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

改成:

    //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();
   }

.. 其余代码应遵循原始脚本。

第 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);
//}

完成上述更改后,我们使用 win rar 并将 Ajax.js 文件放回 ajax4jsf-1.1.0.jar,现在 IE 8 的问题得到解决。

希望它可以帮助那里的人。

于 2012-06-26T19:55:59.623 回答