Comments (18)
There has been a recent change in Chromium: In Chrome 107, attempting to write to the clipboard on page load now triggers a permission prompt. I have removed the code from webplatform.news to not bother my visitors.
from clipboard-apis.
This has been an issue for a while now. Stuff like this is why you shouldn't be enabling JavaScript on random websites.
from clipboard-apis.
Version 105.0.5195.54 (Official Build) (64-bit)
There is still a bug.
from clipboard-apis.
As of this commit, Chromium requires either user activation (at the time of the write) or an explicit permission grant (which is durable across many reads/writes) for writing to the clipboard. As noted in the spec, there are known use cases which rely on the permission grant flow as opposed to the user gesture.
from clipboard-apis.
@simevidas
You wrote about "writing to clipboard". The screenshot shows a dialog about "read from clipboard".
This is constantly mixed (at least in the media about this topic).
My code navigator.clipboard.writeText()
works without any dialog or console log in chrome 108 (after user activation).
Edit: Sorry, you are right. The code and dialog text are not matching. 8-(
Tested with https://fluoridated-showy-fog.glitch.me
from clipboard-apis.
@tomayac Is this on the latest 104 stable build? I added the transient user activation requirement for write()
method but not writeText()
because of some internal site breakage where they are currently relying on this behavior. We have bugs to fix this crbug.com/1334203
from clipboard-apis.
I tested on 104.0.5112.101
, yes.
from clipboard-apis.
Tested on Version 1.42.97 Chromium: 104.0.5112.102 (Official Build) (64-bit) - silent fail - no error, but no effect on clipboard as well
from clipboard-apis.
It should be noted that Chromium-based browsers do have some restrictions for writing text to the clipboard:
- Secure context (https)
- Chome is current app
- Script is running in the active tab
(https://groups.google.com/a/chromium.org/g/blink-dev/c/epeaao7l13M/m/b8ewAH5uBwAJ)
So if a web page is loaded into a background tab, it won’t be able to write to the clipboard.
from clipboard-apis.
Some developments in the Brave browser: brave/brave-core#14901
from clipboard-apis.
@evanstade your link is missing the protocol (https)
from clipboard-apis.
(Corrected link for #182 (comment): https://crrev.com/10300ac7da93a7e322274f1e.)
Are people fine with me closing the Issue as completed?
from clipboard-apis.
Perhaps I am stupid. Is this related to cve-2022-3075. If so I was under the impression this was patched. if I go to webplatfoem.news it continues to write to my clipboard. My chrome is: 106.0.5249.119, My Vivaldi is 5.5.2805.38, and Opera
is 91.0.4516.65.
from clipboard-apis.
from clipboard-apis.
Attempting to write to the clipboard should only trigger a prompt if there's no user action attached.
Yes, Chromium reuses the same permission for both gesture-less reads and writes. The text was not updated because reading is considered more powerful than writing.
from clipboard-apis.
Telling not the truth in such dialogs is IMO a very bad move.
I would reject reading my clipboard on most pages, but writing is often useful (perhaps not without user gesture, but still).
from clipboard-apis.
It is the truth in that the same underlying permission is used for both actions. Granting this permission will affect reading. To avoid permission fatigue, we try to avoid creating too many distinct permissions.
from clipboard-apis.
This issue is creating unnecessary noise in the clipboard repo. The original issue has already been addressed, so if there are any concerns/bugs, please open bugs in the chromium bug database. I'm going to close this issue.
from clipboard-apis.
Related Issues (20)
- Undefined behaviour when handling data promise resolved value HOT 2
- Why does the Clipboard interface extends EventTarget?
- Broken references in Clipboard API and events
- Web Platform tests using "clipboard-read" HOT 2
- Async Clipboard API take more time compared to DataTransfer API to read/write data in System Clipboard HOT 1
- Read Blob data for the supported formats on-demand during getType. HOT 11
- Start and End fragment tags in text/html format on Windows HOT 1
- Add method `match` (`clipboard.match(regex)`) to check clipboard for pattern matching before reading - as it is done in iOS HOT 1
- Optional data types description seems wrong HOT 1
- Feature detection of web custom format support HOT 1
- Parallelism and task sources HOT 2
- algorithms don't enforce focus requirement
- Aljbore HOT 1
- References to permissions
- Topic: ‘unsanitized’ option to allow developers to opt-out of UA-provided sanitization HOT 1
- Merge a PR only with explicit implementor consensus (followup) HOT 4
- read(formats) ambiguous
- RTF is not exposed when using navigator.clipboard.read()
- `supports` should take a dictionary instead of a DOMString as argument for readability HOT 2
- [Async Clipboard API] Use Stream APIs to provide data during write HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipboard-apis.