//不同域名下的单点登录 详细请参考 https://baijiahao.baidu.com/s?id=1700599936444607979&wfr=spider&for=pc
var token = result.data.token;
var iframe = document.createElement("iframe");
iframe.src = "http://app1.com/localstorage.html";
document.body.append(iframe);
iframesetTimeout(function () {
iframe.contentWindow.postMessage(token, "http://app1.com");
}, 4000);
setTimeout(function () {
iframe.remove();},
6000);
window.addEventListener('message', function (event) {
localStorage.setItem('token', event.data)
}, false);
//同域名下的单点登录
cookie的domin属性设置为当前域的父域,并且父域的cookie会被子域所共享。path属性默认为web应用的上下文路径 详细请参考 https://baijiahao.baidu.com/s?id=1700599936444607979&wfr=spider&for=pc