[Proposal] Fragment-directives meant for "UA instructions" #4868
Labels
addition/proposal
New features or enhancements
needs implementer interest
Moving the issue forward requires implementers to express interest
topic: navigation
This is a corresponding issue to whatwg/url#445
Proposal (Summarized from above issue)
We propose amending the URL specification to allow a ## to indicate a fragment directive. A fragment directive would be a part of the URL reserved for UA instructions that's stripped off during loading before being set on the document. Taking an example
In this case, the UA processes the
foo=bar
directive (and uses it to perform some action, e.g. ScrollToText) and strips it from the URL as seen by the page. From the page's point of view:It also has the benefit of likely being parsed as part of the fragment in URL parsers and won't affect the server request so it should be mostly backwards compatible. (Though this URL would fail a strict validation as it's an invalid fragment today)
More details and motivation are in whatwg/url#445
Changes in HTML
There's a number of questions to answer here:
I've got some thoughts on these questions none of which are strongly held.
HTML or other MIME types?
UA directives could be useful across different types. e.g. targetText could be used in text documents just as well as HTML. Other potential uses might be translation, zoom, accessibility features, etc. These all seem to apply to more than just HTML.
When is the fragment directive removed?
In steps 7 and 8 of create and initialize a Document object we set the Document's URL from the request or response URL. Replace these with:
Where do we process the fragment directive?
We can process as part of the try to scroll to the fragment instructions. That is, this would become try to activate the fragment which might perform one or more UA actions and then may or may not attempt to scroll any specified fragment into view.
History? Reload?
As a starting point, I think it makes sense to use the same behavior as fragments.
The text was updated successfully, but these errors were encountered: