TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Doubleclicking on the Web (2015)

41 pointsby Mojahover 4 years ago

12 comments

jchwover 4 years ago
If you want a better server-side solution, you could try employing mandatory idempotency tokens in the request payload. The concept is simple: either have the server give the client an idempotency token as part of the page load, or have the client request one at some point, or have it be something that can be generated on the client side (nonce style) and send it with the request. The server can then validate, using some strongly consistent system, that it has not received any requests in a certain window of time with that token. (Or, possibly, react with the existing response.)<p>This has an additional benefit that even methods like PUT do not: it works no matter how many layers of your stack might have retry behavior (properly or improperly) and enables safe retry even when you can’t be sure if the request went through or not. The primary downside is that it introduces a single point of failure, though you could theoretically shard it by some property of the request such as the session key&#x2F;user id&#x2F;IP address. Still desirable if you have something you really don’t want to repeat, like a transaction. (Probably would be wise to <i>also</i> make those multiple stage, but nonetheless.)<p>Goes without saying you should definitely still mitigate this on the client side by updating the UI state if JavaScript is available.
评论 #24996875 未加载
ktpsnsover 4 years ago
Interestingly, the only persons I&#x27;ve ever seen doubleclicking in the web are from my parent generation (&gt;60, &gt;70 years old).<p>Also since 2015 the mobile adaption increased more and more. On mobile devices, the &quot;double tap&quot; concept never was very important, I think (at least not in the web context).<p>Therefore my feeling is that this issue is mostly a thing from the past.<p>Nevertheless I sometimes see forms which implement this &quot;disable after submission&quot; principle. Especially when it&#x27;s about money, such as when booking a hotel or flight, etc.
Thorrezover 4 years ago
I&#x27;ve actually heard people verbally use the word &quot;doubleclick&quot; to mean explore. For example, someone in a meeting might mention some idea. Then my colleague would say &quot;let&#x27;s doubleclick on that for a minute&quot;.
评论 #24996381 未加载
评论 #24997962 未加载
wingerlangover 4 years ago
I don’t feel like I double click much at all in Windows and macOS nowadays at all.<p>Literally only to open a file from finder, which I use in column mode so navigating is single clicking.
anuilaover 4 years ago
This is something I usually take care of by throttling the relevant event listeners (in an AJAXed site) but the way this article puts it makes me wonder if this is as easy as globally disabling double clicks on links and buttons:<p><pre><code> document.addEventListener(&#x27;dblclick&#x27;, event =&gt; { if (event.target.closest(&#x27;a, input, button&#x27;)) event.preventDefault() })</code></pre>
评论 #24997676 未加载
spiznnxover 4 years ago
If the client-side solution is so simple, what&#x27;s the problem? There are many things on the web where, if given a clean slate, it would be nice to change the default behavior. This doesn&#x27;t seem to rise to the top of that list.
TonyTrappover 4 years ago
For the sake of everyone who loves using the back button, please don&#x27;t disable links when clicking on them.
akerstenover 4 years ago
The proposed solution (an HTML attribute to &#x27;allow&#x27; double-click submissions of &lt;form&gt;s) is backwards from how the standard would be updated.<p>The proposal should instead be for an attribute that <i>prevents</i> double-clicks, because that way browsers that have not implemented it still behave correctly. Additionally, you don&#x27;t &quot;break userspace&quot; for millions of forms online that no longer work as the developer intended.<p>However, I&#x27;m skeptical that we need to encode this at all into the standard, since setting the `disabled` attribute on the submission button after submission is pretty much test case #0 of any serious online form development.<p>Amusingly, things have gotten a lot better since 2015 when this was written. That blob of JQuery is now replaced with binding the `disabled` attribute to `isSubmitted` state on your React-based webform. An interesting glimpse into the web-that-used-to-be.
评论 #24996277 未加载
评论 #24997763 未加载
emmelaichover 4 years ago
Similar problem occurs with the Windows task bar and Mac dock.<p>I&#x27;ve seen new users in particular double click to open.<p>Then, since the machine is so busy, nothing happens for a bit.<p>Concerned, the user then double clicks again. At this point they start to despair or curse.
评论 #24995945 未加载
treveover 4 years ago
Another way this _could_ be solved is to allow HTML authors to use idempotent HTTP methods like PUT.<p>Sadly, it doesn&#x27;t seem browser vendors are very interested to support this.
vim-guruover 4 years ago
I&#x27;m certain that there&#x27;s a lot of these issues that could be solved browser-side. Something for a breaking html6 maybe
squamover 4 years ago
&gt; What if a double-click is blocked by default<p>I agree this would be a more sensible behavior for form submission, but given that ship has long since sailed: <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1172&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1172&#x2F;</a>