[bug] The new page under same origin can't get session timely when browser location change.
ex:
- I set a session in localhost/via-1/index.html(sessionStorage.setItem('autoInfo', 'it is for test'))
- jump to localhost/via-2/index.html(window.location = '/via-2')
- get the session when the new page init,it's null(sessionStorage.getItem('autoInfo', 'it is for test')) here is the test page, just run it.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>via-1</title>
<script>
/**
* nginx目录:
* |via-1
* | -index.html
* |via-2
* | -index.html
*/
window.onload = () => {
sessionStorage.setItem('autoInfo', 'it is for test')
document.querySelector('.btn').addEventListener('click', () => {
// 这里去掉定时器,则跳转页面获取autoInfo的sessionItem失败
setTimeout(() => {
window.location = '/via-2'
}, 5000)
})
}
</script>
</head>
<body>
<div class="btn">click to go to via2</div>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>via-2</title>
<script>
window.onload = () => {
document.querySelector('.authInfo').textContent = sessionStorage.getItem('autoInfo')
}
</script>
</head>
<body>
<div class="btn">this is via-2</div>
<div class="authInfo"></div>
</body>
</html>
env: via: 4.3.0(20210627) android: 11 mobile: mi 10 mobile os: MIUI 12.5 21.8.11
Turn off "Go back without reloadding" in setting. This feature will create a new webview everytime when location change. So the sessionstorage won't be shared because they are in different webviews. I think this feature should not be enabled by default, but it is.
Turn off "Go back without reloadding" in setting. This feature will create a new webview everytime when location change. So the sessionstorage won't be shared because they are in different webviews. I think this feature should not be enabled by default, but it is.
Thank you.