how browsing-context works

2

I was reading the documentation for the target attribute of the HTML element <a> :

  

(...) In HTML5, it is a name or keyword that refers to a navigation context (for example, tab, window, or a frame) / p>

What is a navigation context and how does it work?

    
asked by anonymous 05.11.2015 / 18:54

1 answer

3

The navigation context can be understood as an instance (or session) of the browser, it can be a window, a tab or a <iframe> , with independent navigation history.

In HTML 5 a context is created by setting a <iframe> with the name attribute or clicking a link or sending a form with the target attribute set other than the special values ( _self , _blank , etc.).

Example of operation:

Note: You have to save the content in an HTML file because it does not work correctly on the site because of restrictions.

Click the first link, it will open in a new tab (create a new context), go back to the tab and click on the second link that will open in the same tab as the first link. Because both links have the attribute target with value meu-contexto .

<ol>
  <li><a href="http://pt.stackoverflow.com/" target="meu-contexto">StackOverflow pt</a></li>
  <li><a href="http://stackoverflow.com/" target="meu-contexto">StackOverflow en</a></li>
</ol>

The name of the current context can be accessed by the window.name Javascript property. Modifying this property can unlink the current context from the parent context. You can create a link by modifying this property only when a parent / child relationship, such as <iframe> .

Related documentation: link

    
05.11.2015 / 18:54