News for hackers. Stuff that matters.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by jypepin on Friday February 15, 2019 @04:43AM (#19169638)
Aren't url fragment originally used for page position already? Like url.com/#title would scroll to the page the div with id "title"? In that case I don't feel like using url fragment for a word position is so much breaking it, it keeps the use of url fragment for info about page position, right?
Re:Chrome will Soon Let You Share Links to a Specific Word o... by lucideer on Friday February 15, 2019 @07:39AM (#19170371)
Yes but this is about namespacing/syntax and likelihood of clashes.

Normally, url fragments were intended to be used by page authors, making clashes impossible (page author controls both page and anchor syntax). Google are breaking this contract, but argue that the fact that they're using parameter-style syntax should not clash with author usage, because using parameter-style syntax is "an abuse" of the feature.

Re:Chrome will Soon Let You Share Links to a Specific Word o... by deepstream on Friday February 15, 2019 @08:08AM (#19170561)
This is a good point, which I didn't get until your comment. I think they should surface this on that page, because it seems everyone is thinking this will be a big clash, but as you say, if someone shares a sentence, the likelihood is low.

To double check, does this means things like,

  https://www.spa/#!/path/to/view
Can become

  https://www.spa/#!/path/to/view&targetText=percent%20encoded
The only part I don't get about the likelihood and this extension is how it interacts with these kind of hash routes.

I haven't thought that much about the next part, but how do people feel about the following?

  web+text://https://www.spa/#!/route/to/view#targetText=percent%20encoded
or something. Rather than extending URLs vertically, extend horizontally into a different protocol the URI of which can encode the syntax elegantly.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by sokoloff on Friday February 15, 2019 @10:22AM (#19171574)
I think that's more risky in that most browsers and many intermediate proxies or other traffic inspectors are likely to have special casing around http: (at least) and https: and for most traffic to be over http(s): and a tiny sliver over web+text: seems fraught with more peril than a (fairly small and intention-aligned) abuse of #fragments. Even mail agents, markdown processors, and other text-display applications often have special casing to turn http(s) URLs into touchable/clickable links.

Page authors are unlikely to use web+text: if it means cutting off old browsers from access.

Re:Chrome will Soon Let You Share Links to a Specific Word o... by croddin on Friday February 15, 2019 @10:18AM (#19171534)
Googles’s fragment solution should gracefully degrade to behaving like the normal link in other browsers (as long as there isn’t some fragment conflict) but creating a new pseudo protocol would have to be supported by each browser to even get to the site.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by Robin_Message on Saturday February 16, 2019 @03:01AM (#19177630)
You could use two hashes like that and stick with http. I reckon browsers would cope, and you could strip the second one.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by kolinko on Saturday February 16, 2019 @03:19AM (#19177693)
Well, if we're talking about intention, they were originally a browser feature allowing to scroll to a specific <a target=..>. They were invented before JS if I'm not mistaken, so the assumption was that the browser was handling it.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by 7952 on Friday February 15, 2019 @09:08AM (#19170993)
That is true of any URL, the user can decide to use it in ways you don't want. But that is also an intrinsic feature of the web. The best approach is to give users flexibility, but accept that websites may overide that behaviour.
Re:Chrome will Soon Let You Share Links to a Specific Word o... by pbhjpbhj on Friday February 15, 2019 @09:20AM (#19171080)
Originally used with <a> anchors IIRC. So, yes it breaks the original use, instead of scrolling to the anchor with the correct "name" it could/would scroll to a different text search point.

Why not "##" as a new URL fragment, or add a "scrollto" to the link tag that the browser can use?

I guess those were discussed, is there an RFC?

Re:Chrome will Soon Let You Share Links to a Specific Word o... by coldtea on Friday February 15, 2019 @06:51AM (#19170114)
>Aren't url fragment originally used for page position already? Like url.com/#title would scroll to the page the div with id "title"?

That was the pre-SPA, traditional role of anchors...

If you did any html between 1995-6 and 2005, you'd use it for that.

Then, with AJAX/SPAs, # was used for state (pre-history API) -- and I'd assume many webpages are still left at that use.

Re:Chrome will Soon Let You Share Links to a Specific Word o... by tyingq on Friday February 15, 2019 @07:34AM (#19170324)
Of course, page anchors are still in wide use, and not just on old pages. https://github.com/facebook/react/blob/master/README.md#inst...
Re:Chrome will Soon Let You Share Links to a Specific Word o... by reaperducer on Friday February 15, 2019 @09:01AM (#19170949)
Very wide use.

I just finished a large healthcare web site that uses page anchors.

Page anchors are recommended by one of the (many) federal web accessibility guidelines. This is so that people with limited motion or poor motor control, or visual impairments don’t have to scroll to find what they’re looking for on a page.

It’s also how the “Skip to content” links work, which is Accessibility 101.

Sorry, I’m not at work or on a computer so I can’t link to a reference.

Re:Chrome will Soon Let You Share Links to a Specific Word o... by reaperducer on Friday February 15, 2019 @11:05AM (#19171962)
Here's a reference for "Skip to content" for those who have never bothered to make their web sites usable for people who aren't 20-somethings in perfect health (Google):

https://webaim.org/techniques/skipnav/