当前位置:网站首页>a标签或者<router-link>使用target=“_blank“打开新页面,新页面的sessionStorage丢失
a标签或者<router-link>使用target=“_blank“打开新页面,新页面的sessionStorage丢失
2022-04-21 11:55:00 【-阿布-】
简单的解决办法 - a标签添加属性 rel="opener"
Chrome对于a标签默认添加了noopener属性,所以通过a标签跳转,会丢失新页面的控制权,sessionStorage自然也就丢失了,我们只需要在a标签上加上 rel="opener" 就行了。
在Chrome浏览器89版本前,当前会话页面指的是当浏览器窗口没有关闭时,窗口内同域网站可以共享此数据(同源浏览器多个窗口不共享),当页面全部关闭或窗口关闭后,sessionStorage数据会被摧毁,所以你用a标签跳转还是js跳转都会共享sessionStorage。
在2021年3月初Chrome浏览器进行了批量更新,更新到89版本后,通过a标签target="_blank"跳转到新页面时sessionStorage就会丢失。Chrome这一更新可能会导致很多网站的sessionStorage丢失。
版权声明
本文为[-阿布-]所创,转载请带上原文链接,感谢
https://blog.csdn.net/cainiao1412/article/details/124289967
边栏推荐
- L2-039 inventory code base (25 points)
- Xinghan will become the co construction unit of finops industry promotion matrix in the future
- JSTL -- JSP standard tag library
- Xinghan future cloud native basic governance platform schedulx v1 1.0 heavy release to help enterprises reduce costs and increase efficiency
- 【链表】148. 排序链表
- Forward port 80 requests to other ports
- 一个猜数字的小游戏
- C language: pointer 2 (linear table knowledge + detailed explanation of examples)
- 【招聘测评题】中的(行测)图形推理题基本逻辑总结(附例题)
- L2-003 moon cake (25 points) (greedy)
猜你喜欢

DR-AP6018-A-wifi6-Access-Point-Qualcomm-IPQ6010-2T2R-2.5G-ETH-port-supporting-5G-celluar-Modem-aluminum-body.

Zhongshanghui ⺠ evolution of trading platform architecture: response to Apache shardingsphere

Massive data generated 421 million yuan of revenue in 2021, and the gross profit margin of database products increased by 8.78%!

Wechat applet to uniapp

Static and non-static construction method of parent-child class loading order

如何跨域请求携带 cookie ?

教你轻松解决CSRF跨站请求伪造攻击

Sentinelsat package introduction

【C语言实现通讯录】一文带你遍历C语言重难点

One day, Alibaba database will squeeze Oracle out of the market
随机推荐
《深度学习》学习笔记(七)
俄外交部官员:在乌特别军事行动将在北约造成的安全威胁被消除后结束
Leaflet military plotting - Assault direction modification (leaflet chapter. 90)
JSON and related
【软件测试系列四】《软件测试需关注的测试点》
Haiwell Cloud Scada Designer 3
The fourth day of LC brushing
【C语言实现通讯录】一文带你遍历C语言重难点
PHP 零基础入门笔记(11):字符串 String
No supported authentication methods available
【软件测试系列九】《压力测试申请需提供事项说明》
L2-009 抢红包 (25 分)(结构体排序)
HMS Core 6.4.0版本发布公告
How to find the source code, inverse code and complement code
分享 Map 对象和普通对象的 7 个区别
Is it safe to open an account for stock speculation
Dynamics CRM 365 在Plugins调用外部接口报错:请求'System.Net.WebPermission,System,Version=4.0.0.0,Culture=neutral,PublicKey=b77a5c5561934e089'类型的权限已失败
C language: pointer 2 (linear table knowledge + detailed explanation of examples)
Share 7 differences between map objects and ordinary objects
L2-001 emergency rescue (25 points) (Dijkstra comprehensive application)