TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Why do websites prevent pasting via onpaste="return false;"

5 点作者 gleenn6 天前
Why do websites do this? Isn't it trivial for bots etc to easily side-step any protection this might give? Or is it just to make people "double-check" their inputs? I find it completely maddening because I would assume I'm way more likely to correctly input a copy-pasted e.g. routing or account number than if I have to manually enter anything. Can we just agree this is terrible UI and is probably detrimental to correct data entry? What am I missing? In frustration I even sometimes open the dev tools and remove this attribute on elements out of spite.

4 条评论

blazeWayne5 天前
It is a god awful pattern! It should be gotten rid of across the web.<p>However, I have noticed that, on some fields, the field rejects certain input without any message if the input is not the correct intended field type. For example, copying a numeric one time password from an email which gets copied as string and pasting on a field which only accepts numbers. This might look like paste blocking but its not.
pwg6 天前
&gt; Can we just agree this is terrible UI<p>It is, but they had some &quot;checklist&quot; that included &quot;block paste&quot; for reasons unknown, and so they blocked pasting.<p>In firefox, if you change the about:config setting &quot;dom.event.clipboardevents.enabled&quot; to false you&#x27;ll be able to paste no matter whether the website operator has &quot;block paste&quot; on their braindead checklist or not.
journal4 天前
you can do some interesting things if you record time between character inputs and analyze across many users, almost like fingerprinting the way someone would type a unique set of characters, we&#x27;d all do it differently probably and maybe that can be fingerprinted.
ttw445 天前
You&#x27;re not wrong in any capacity. It&#x27;s just bad and doesn&#x27;t improve any &quot;security&quot; if that was intended.