通過鏈接跳轉登錄到另外一個系統


function js_method(){
window.open("http://localhost:1234/test/user/mylogin?login=test");
}

<a src="" href="javascript:void(0);" onclick="js_method()">登錄</ a>

 

private void mylogin() throws Exception {
HttpSession session = request.getSession(true);
response.setHeader("Access-Control-Allow-Origin", "*");

String username = request.getParameter("login");

//1. 檢查用戶是否存在

session.setAttribute(OnlineUser.class.getSimpleName(), onlineUser);
response.sendRedirect("/test/page/system/main.html?" + new Date().getTime());
}

在IE瀏覽器下Session會丟失,需要用另外一個方法

function js_method2(urlstr){

var openobj = window;
if(typeof(window.dialogArguments) == 'object')
{
openobj = window.dialogArguments;
}
openobj.open(urlstr,"_blank");

}

<a href="#" onClick="js_method2('http://localhost:1234/test/user/mylogin?login=test')" >登錄</a>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM