Google chrome doesn't take window.name into account

☆樱花仙子☆ 提交于 2019-12-04 04:16:56

问题


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

For example Page A opens popup named "thug"

Now I open up a new tab . enter localhost/pageA , and get to see a popup

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

Please help


回答1:


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.

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.



来源:https://stackoverflow.com/questions/10259887/google-chrome-doesnt-take-window-name-into-account

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!