gpt4 book ai didi

html - 打开浏览器窗口或选项卡后,如何给它一个 "name"?

转载 作者:可可西里 更新时间:2023-11-01 13:33:52 25 4
gpt4 key购买 nike

我有一个应用程序是一个链接到其他应用程序的门户。这些链接会打开那些带有 target='app-name' 的应用程序,这样如果他们再次打开它并且窗口存在,它就会在同一个窗口中打开。

然而,在应用程序中,我们有一个返回门户窗口的链接,但该窗口没有“target=portal”标签……它首先打开 - 比方说通过书签。因此,当单击链接时,我们会得到一个新的门户选项卡/窗口……现在我们有两个。用户希望我们找到现有的。

那么我如何“命名”门户窗口以便我可以使用 target='portal' 返回它?

最佳答案

你可以试试

window.name = 'portal';

根据 MDN article about window.name ,

Gets/sets the name of the window.
The name of the window is used primarily for setting targets for hyperlinks and forms.

请注意它是 DOM 级别 0,不属于任何标准。

关于html - 打开浏览器窗口或选项卡后,如何给它一个 "name"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22230048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com