我想在同一浏览器中多次登录该域。 例如,如果我在第一个选项卡中登录,并且如果我在同一浏览器中打开第二个选项卡,则不存在与第二个选项卡的共享会话,而应该是一个新的消息服务呼叫slack。
我在下面的代码块中尝试过,但是我该如何实现呢?
var clearLocal = window.localStorage.clear.bind(window.localStorage);
var getLocal = window.localStorage.getItem.bind(window.localStorage);
var keyLocal = window.localStorage.key.bind(window.localStorage);
var removeLocal = window.localStorage.removeItem.bind(window.localStorage);
var setLocal = window.localStorage.setItem.bind(window.localStorage);
window.localStorage.getItem = function(key) {
alert("inside account key " + key);
var newKey = accountId + "::" + key;
alert("inside account new key " + newKey);
return getLocal(newKey);
}
window.localStorage.key = function(index) {
console.log("KEY " + index);
return keyLocal(index);
}
window.localStorage.removeItem = function(key) {
var newKey = accountId + "::" + key;
console.log("REMOVE " + newKey);
return removeLocal(newKey);
}
window.localStorage.setItem = function(key, value) {
var newKey = accountId + "::" + key;
alert("inside account new key " + newKey);
return setLocal(newKey, value);
}
任何建议都值得赞赏。.