5

Is there a way to access browsing context in JavaScript?

Update: I'm reading HTML5 specification and there, it says that for each new tab, or new window, or iframe there is a notion of browsing context which is created by browser and each new document that you surf (each new link) would be stored and presented to users in this browsing context.

I just wonder if we have access to it. For example, a browsing context has a history and we can access that using window.history.

Saeed Neamati
  • 35,341
  • 41
  • 136
  • 188

1 Answers1

5

Yes with the window object

see what w3 says about it

You can use window.top to access the top most context for instance.

Joseph Marikle
  • 76,418
  • 17
  • 112
  • 129
  • I'm reading the same text, but nowhere it says anything about any API to access browsing context. Anything I missing? – Saeed Neamati Aug 04 '11 at 14:04
  • 1
    @SaeedNeamati "A browsing context is an environment in which Document objects are presented to the user." and "window.top Returns the WindowProxy for the top-level browsing context.". see how to access them in this section: http://dev.w3.org/html5/spec/browsers.html#navigating-nested-browsing-contexts-in-the-dom. – Joseph Marikle Aug 04 '11 at 14:07