سؤال

I have an application that is a portal which links to other apps. The links open up those apps with a target='app-name' so that if they open it again and the window exists, it opens in the same window.

However, while in the app, we have a link to go back to the portal window but that window has no 'target=portal' tag...it opened up first - let's say via a bookmark. So when the link is clicked, we get a new portal tab/window...now we have two. The users want us to find the existing one.

So how do I 'name' the portal window so I can get back to it with a target='portal'?

هل كانت مفيدة؟

المحلول

You can try

window.name = 'portal';

According to 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.

Be aware it's DOM Level 0, not part of any standard.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top