Re: [w3c/webcomponents] <iframe> and the History API (#184)

Let me extend @annevk's 3. How about this?

Let's define a new attribute "isolatehistory" (or something) for `<iframe>` and define the behavior for `window.history` as follows and make it usable for both `<iframe>` in document tree and in shadow tree. We might mandate the "isolatehisory" behavior by default (without attribute) inside shadow DOM.

* Bottomline:
  * navigation history inside `<iframe>` will not be merged to top-level browsing context's [joint session history](https://html.spec.whatwg.org/multipage/browsers.html#joint-session-history).

* `window.history`
  * `<iframe isolatehistory>` has its own independent session history.
  * `go()`/`forward()`/`back()` works on its own session history.
    * if the script really wants to go back for the whole document, `window.parent.history.go(-1)`.
  * `pushState()`/`replaceState()`/`state` works on its its own session history.
  * `length` returns its own session history's length.
  * `scrollRestoration` affects only for the `<iframe>` itself.

* link anchor in `<iframe>`'s document
  * following a link will navigate inside `<iframe>`, and add it to its own session history.
  * `target` attribute on anchor works the same way without "isolatehistory" attribute.

* nested `<iframe>`
  * nested child `<iframe>`'s session history will be joined to its own session history, and will not leak to outer browsing context.

* browser's forward/back buttons (is this in any HTML spec?)
  * forward/back buttons follow the top-level browsing context's joint session history.
  * therefore inside `<iframe>`'s navigation history isn't counted.  To compensate this, right-click menu can have back/forward menu item for the `<iframe>` (see next).

* context (right-click) menu
  * on "isolatehisotry"-iframe's region, context menu can include "back in frame" "forward in frame" menuitems to compensate browser's forward/back button not working for `<iframe>`'s content. (analogous to reload or view source)

This may still miss something (very probable).  But could we converge on something like this?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/184#issuecomment-212817696

Received on Thursday, 21 April 2016 08:52:59 UTC