Skip to content

Can opaque origin documents navigate to javascript: URLs? #7052

Open
@jakearchibald

Description

@jakearchibald

In #6798 I preferred the Firefox model where a javascript: navigation creates a history entry with a new document state (rather than Chrome's model where it updates the existing document state).

However, it creates an interesting situation:

  1. Navigate to data:text/html;charset=utf-8,%3Cp%3Ehello%3C%2Fp%3E
  2. location.href = 'javascript:"hello"'

In the Firefox model, this would create two history entries that have different documents, but exist in the same opaque origin. However, Firefox disallows this kind of navigation.

Opaque origins aren't serialisable, so there's no guarantee that the two entries will remain same origin to each other after things like a browser restart.

Options:

  • Disallow this kind of navigation (like Firefox currently does).
  • Create a new opaque origin in step 2 above (although a synchronous origin switch seems bad).
  • Allow opaque origins to be serialised in some way.

This came up in WICG/navigation-api#167

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions