4 ms·
How difficult would it be to write a browser extension to either remove all zero-width characters or somehow make it super obvious that they are being used on t
by irrational 9y ago
How difficult would it be to write a browser extension to either remove all zero-width characters or somehow make it super obvious that they are being used on the page?
I just searched for "zero-width" and "zero width" in Chrome and Firefox's extensions stores, but didn't come up with anything.
- vbezhenar 9y agoI don't think that it's too difficult. Just check every tag's text for forbidden characters and replace them with something. I'm not sure about performance.
- scottmf 9y agoBesides performance concerns, if you did it on each page load it would miss any content added to the page after the initial load. It would be useless for SPAs. The best way I can think to implement it would be listening for a copy event and replacing the text in the clipboard. Something like: document.addEventListener('copy', sanitizeClipboardContent);
- tim333 9y agoProbably not too hard. I've made a jsfiddle to identify and remove such stuff. Feel free to copy any of it to an extension. https://jsfiddle.net/tim333/np874wae/13/ https://jsfiddle.net/tim333/np874wae/13/
- flanbiscuit 9y agoI took your code and added to it. Removed jQuery and it now searches through ALL text nodes on a page and replaces the text in it with the hidden characters plus the original visible text. There's still lots of room for improvement but it's a start. For now I'm running it in the console to make it work but someone can build upon this and turn it into an extension (maybe I will if I have time) I put it in a gist: https://gist.github.com/FranciscoG/01732b606a35615891103ae8e8e5a7a4 https://gist.github.com/FranciscoG/01732b606a35615891103ae8e...
- jessriedel 9y agoWould probably be better to do this at the OS level, no? Just ensure that shift-cmd-V/shift-ctrl-V strips zero-width characters in addition to formatting. I can't think of a situation where I'd want to keep one but not the other, and you could always do that manually if it came up.
- inetknght 9y agoIf it'd also optionally (default=true) strip text formatting from copy/paste that'd be epic. No more copy-from-browser-then-paste-into-notepad-then-copy-from-notepad-then-paste-into-email-or-chat
- matthberg 9y agoIn a good few applications that is exactly what Ctrl+Shift+V does. Try it in Chrome or Firefox, it pastes without formatting.
- jessriedel 9y agoWhat matthberg said. I'm on a Mac and I use shift-cmd-V frequently (more often than cmd-V). Unfortunately, there are a few apps that use cmd-opt-shift-V instead of cmd-shift-V. You can fix most of them using this: https://apple.stackexchange.com/questions/182970/paste-to-match-style-app-shortcut https://apple.stackexchange.com/questions/182970/paste-to-ma... After that, almost everything will use cmd-shift-V. However, Microsoft Word is still broken, apparently because it uses a slightly different command that does a similar thing, "Paste and Match Formatting". Haven't found a way to fix that yet.
- inetknght 9y agoLinux.
- yuubi 9y agoArabic? I think the are cases where letters are joined or not by default, but sometimes need to be forced to the other state, depending on meaning that the text layout engine isn't expected to be able to figure out.
- kccqzy 9y agoZero width characters have legitimate uses such as family emojis and certain Indic scripts. You don't want to break these.
- deleted 9y ago[deleted]
- irrational 9y agoI'd rather be protected from tracking than worry about some emojis breaking or text in script I can't read formatting incorrectly. Of course, this should be an individual decision since some people do read those scripts and some people do care about emojis.
- koheripbal 9y agoWhenever I paste, I use ctrl-shift-v. It solves this problem and a multitude of other pasting problems.
- djsumdog 9y agoThat just removes formatting, reducing the copied text to plain-text. If I paste the strings from the blog post into atom and then arrow right from the beginning, there are locations where the col number will increase and the cursor not move. I don't think ctrl-shift-v will do what you think here because we're not talking about formatting at all. We're talking about regular unicode UTF-8 encoded text.
- itakedrugs 9y agothat doesn't work on my computer (Fedora), but what I usually do is paste it in a box that doesn't allow formatting and then copy it again... but I don't know if it would remove fingerprinting in this case
- roymckenzie 9y agoI just made a very basic one: https://chrome.google.com/webstore/detail/icibkhaehdofmcbfjfpppogioidkilib/publish-accepted?authUser=0&hl=en-US https://chrome.google.com/webstore/detail/icibkhaehdofmcbfjf... Code here: https://github.com/roymckenzie/detect-zero-width-characters-chrome-extension https://github.com/roymckenzie/detect-zero-width-characters-... Submit a PR! I know it could be better! Needed features: * right-click selected text and "Sanitize and Copy" * toggle off and on ...
- dbg31415 9y agoWorking link https://chrome.google.com/webstore/detail/detect-zero-width-charact/icibkhaehdofmcbfjfpppogioidkilib https://chrome.google.com/webstore/detail/detect-zero-width-...
- Too 9y agoNo need to replace text. Patch all the fonts in your OS to display something instead of zero width. That will work outside the browser also. There really is no valid use case in Latin script so why is zwsp allowed next to Latin characters?! (Emojis is not a valid use case, and why do they depend on zwsp anyway?)