Google chrome doesn#39;t take window.name into account(谷歌浏览器不考虑 window.name)
问题描述
我知道在 window.open(url,name... 中,如果已经存在同名的弹出窗口,该名称基本上会限制浏览器不要再次打开弹出窗口
I've know that in window.open(url,name... the name basically restricts a browser not to open a popup again , if a popup with the name already exists
例如页面 A 打开名为thug"的弹出窗口
For example Page A opens popup named "thug"
现在我打开一个新标签.输入 localhost/pageA ,然后看到一个弹出窗口
Now I open up a new tab . enter localhost/pageA , and get to see a popup
这是问题所在,如果我在新选项卡中再次输入 URL localhost/pageA,它将重新打开弹出窗口,而不是它应该引用了之前的弹出窗口.因为他们有相同的名字
Here is the problem , if i enter the URL localhost/pageA again in a new tab , it'll REOPEN the popup , rather it should have had referenced the earlier popup. because they have the same name
请帮忙
推荐答案
Chrome 中两个选项卡中的 JS 脚本在不同的上下文中运行,因此无法共享打开哪个窗口的信息.此行为是一项安全功能,我相信 Google 会在此处更好地解释它.
The JS scripts in two tabs in Chrome are ran in separated contexts and cannot thus share the information on which windows did one open, one to another. This behavior is a security feature and I believe it is better explained by Google, over here.
根据您的应用所需的防弹级别,您应该使用 AJAX、cookie 甚至持久存储来检查该窗口的存在和状态.
Depending on the level of bulletproofing required by your app, you should use either AJAX, cookies and even persistent storage to check for that window's existence and state.
这篇关于谷歌浏览器不考虑 window.name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:谷歌浏览器不考虑 window.name


- addEventListener 在 IE 11 中不起作用 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01
- Flexslider 箭头未正确显示 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 失败的 Canvas 360 jquery 插件 2022-01-01