Re:Ask HN: Why clicking on favorite takes you to favorites p...
by metadat on Friday October 14, 2022 @09:48PM
(#33210842)
It's because HN uses very little Javascript. So this is the way it works, a simple get request to an endpoint.
[ Parent
| on HN ]
Re:Ask HN: Why clicking on favorite takes you to favorites p...
by Minor49er on Friday October 14, 2022 @10:07PM
(#33210936)
I'm not on a computer to test this, but I wonder if it would be possible with the href attribute set to a fragment (#) and the ping attribute set to the URL where a favorite gets saved. I'm not sure if ping works without navigating to another page or not
Re:Ask HN: Why clicking on favorite takes you to favorites p...
by metadat on Friday October 14, 2022 @10:10PM
(#33210959)
I don't think the #-and-after portion gets submitted to the server. IIRC it's reserved exclusively for client-side use.
When in doubt I suggest simply emailing our moderator, TheDang: [email protected]. They are the ultimate arbiter of these matters.
Re:Ask HN: Why clicking on favorite takes you to favorites p...
by Minor49er on Sunday October 16, 2022 @04:54AM
(#33222194)
No, the fragment wouldn't get sent to the server at all. The ping part would though
Re:Ask HN: Why clicking on favorite takes you to favorites p...
by gus_massa on Friday October 14, 2022 @11:58PM
(#33211601)
My guess is it sends you to the favorite page so you are sure it has been saved there. I think it can be implemented differently, like the upvotes that are counted without a page change.