IE11 - 客户端重定向到 jsp 无法访问会话属性

IE11 - Cient side redirect to jsp unable to assess session attribute

我的登录ajax调用是这样的

        $.get("LoginServlet", {'agileid': id, 'passwd': passwd, 'remember': 'yes' }, function(data) {
        var results = JSON.parse(data);
        if ( results.status == "failed") alert(data);
        else window.location.href = 'Main.jsp'; 
    });

我的LoginServlet会设置一个session属性特殊对象,客户端无法保存。

在 Main.jsp 中,将确定会话对象的存在并执行必要的操作。

<%@page import="agile.px.myagiledashboard.listeners.SessionResourcesObject"%>
<%@ page contentType="text/html;charset=UTF-8" session="false" %>
<!DOCTYPE html>
<%
HttpSession hSession = request.getSession();
System.out.println("Main.jsp: " + hSession.getId()); //This is to make sure the session is the same as in LoginServlet request
SessionResourcesObject SRO = (SessionResourcesObject)    hSession.getAttribute("SRO");
String userName = "";

if ( SRO != null) {
try {
    userName = SRO.getCUser();
    System.out.println("main.jsp: " + userName);
} catch (Exception e) {

}

}

%>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
....

该代码适用于 Chrome,但在 IE11 中使用 运行 时(在兼容模式下 - 公司 IT 策略 - 无法更改),会话对象在重定向到 jsp页。

有人遇到同样的问题吗?或者谁能​​指出我的代码中的问题并解决这个问题?

谢谢,

亚历克斯

奇怪:使用 location.href 解决了问题。 Chrome 的行为没有区别,但在 IE11 中 location.href 不会创建新会话,但 window.location.href 会。