Home > Software engineering >  Set framename of browsing context
Set framename of browsing context

Time:12-23

Is it possible to set the framename of the current browsing context using javascript?

Problem: I have a link with some target framename e. g. <a href="someSite.html" target="someSite">some Site</a> This link opens in a new browsing context (i. e. tab). When already open the webbrowser switches to that context (tab).

Now the content on someSite.html can change and I want to modify the framename so that using the above link opens a new browsing context (tab) instead of switching to the existng one that changed.

Think of it as a link to a "create new document" webpage and once you type something and save it the framename should be changed. So that the "new document" link always opens the empty new document browsing context unless you already have one open.

CodePudding user response:

You can set the window.name property to the empty string. This will prevent the window's browsing context from being targeted by other links.

window.name = "";

As a fiddle since StackSnippets don't allow opening popup windows.

  • Related