Chrome不会考虑window

Chrome不会考虑window

本文介绍了Google Chrome不会考虑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 examplePage 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

请帮助

推荐答案

p> Chrome中的两个选项卡中的JS脚本在分离的上下文中运行,因此无法共享哪些窗口打开一个到另一个窗口的信息,这种行为是一个安全功能,我相信。

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.

这篇关于Google Chrome不会考虑window.name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 03:28