搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

了解更多

Copy/Paste

more options

Why can a stupid failing script on a web-page, or even intentionally so programmed script disable the copy (and sometimes paste) functionality?

How can this be disabled/fixed?

One highlights a text (any text) on some web sites, Edit menu allows Copy, context menu allows Copy, one hits Copy, nothing happens. It's not even a page where someone wanted to "copy protect" some information.

Copy and Paste should work just as advertised since those were invented, how hard can it be to get that right? Even stupid Notepad never fails at it. And no, I don't care what the idiot who programmed a page though would be/should be best for me, I want Copy to be copy, Paste to be paste. This used to work in "original" Firefoxes even when page developers wanted to make it not work.

And yes, while on a given page Copy fails miserably, at the same time in other pages it works.

Why can a stupid failing script on a web-page, or even intentionally so programmed script disable the copy (and sometimes paste) functionality? How can this be disabled/fixed? One highlights a text (any text) on some web sites, Edit menu allows Copy, context menu allows Copy, one hits Copy, nothing happens. It's not even a page where someone wanted to "copy protect" some information. Copy and Paste should work just as advertised since those were invented, how hard can it be to get that right? Even stupid Notepad never fails at it. And no, I don't care what the idiot who programmed a page though would be/should be best for me, I want Copy to be copy, Paste to be paste. This used to work in "original" Firefoxes even when page developers wanted to make it not work. And yes, while on a given page Copy fails miserably, at the same time in other pages it works.

所有回覆 (17)

more options

Hi Pók, sites can detect the copy and paste actions in their scripts and modify the results. You can block this, but then pasting will not work on some sites. You can test it out and see how it goes on the sites you use:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste clipb and pause while the list is filtered

(3) Double-click the dom.event.clipboardevents.enabled preference to switch the value from true to false

Any difference on the problem site (you might need to reload the page)? If not, then flip it back and I think we'll need more information to understand what the site is doing.

more options

Thanks for the suggestion, but I use pages where the clipboard access is actually useful and needed.

In my opinion the proper solution would allow both JS and the Edit -> Copy menus to set the clipboard, but to only allow overwriting clipboard data set by menus (Edit & context) with clipboard data set by JS if user permission is granted. Or at least not let JS know that the UI has just put something on the clipboard, not giving a chance for the former to "react" and clear the value just set.

And another problem is that I'm not even sure the problem is site-related. E.g. after a browser restart the same page behaved OK, could copy and paste text as expected. What might somehow, maybe had an effect on this is that it was waiting for a restart upon an update (I'm running the Developer beta edition). But that still does not explain why on other pages Copy and Paste did work. Also it is not the first time this happens.

more options

Pók said

Thanks for the suggestion, but I use pages where the clipboard access is actually useful and needed.

I'm not sure I understand your comment. This setting does not prevent copy/paste from working in normal form fields and normal edit areas. It prevents sites from using script events to intercept and modify how copy/paste work on their pages. Let me know if you try it.

And another problem is that I'm not even sure the problem is site-related. E.g. after a browser restart the same page behaved OK, could copy and paste text as expected. What might somehow, maybe had an effect on this is that it was waiting for a restart upon an update (I'm running the Developer beta edition). But that still does not explain why on other pages Copy and Paste did work. Also it is not the first time this happens.

Is there a page where you reliably cannot copy/paste (that doesn't require an account to use)?

Note: there's a link moderation feature on the forum, so if you share a URL without breaking it to make it non-clickable, your post usually will be delayed in appearing.

more options

Do the alternatives work in case the script only blocks the Ctrl key ?

  • Copy: Ctrl+C or Ctrl+Insert (Mac: Command+C)
  • Paste: Ctrl+V or Shift+Insert (Mac: Command+V)
  • Cut: Ctrl+X or Shift+Delete (Mac: Command+X)
more options

jscher2000 said

Pók said

Thanks for the suggestion, but I use pages where the clipboard access is actually useful and needed.

I'm not sure I understand your comment. This setting does not prevent copy/paste from working in normal form fields and normal edit areas. It prevents sites from using script events to intercept and modify how copy/paste work on their pages. Let me know if you try it.

Yes, that's what I mean: I use sites that set the clipboard using scripts. That is why I don't want to disable the functionality.

And another problem is that I'm not even sure the problem is site-related. E.g. after a browser restart the same page behaved OK, could copy and paste text as expected. What might somehow, maybe had an effect on this is that it was waiting for a restart upon an update (I'm running the Developer beta edition). But that still does not explain why on other pages Copy and Paste did work. Also it is not the first time this happens.

Is there a page where you reliably cannot copy/paste (that doesn't require an account to use)?

No, I notice this problem totally random. As mentioned earlier, after a restart the Copy and Paste menus (and shortcut keys) started working again on the very same page.

Note: there's a link moderation feature on the forum, so if you share a URL without breaking it to make it non-clickable, your post usually will be delayed in appearing.

more options

double-post

由 Pók 於 修改

more options

cor-el said

Do the alternatives work in case the script only blocks the Ctrl key ?
  • Copy: Ctrl+C or Ctrl+Insert (Mac: Command+C)
  • Paste: Ctrl+V or Shift+Insert (Mac: Command+V)
  • Cut: Ctrl+X or Shift+Delete (Mac: Command+X)

No, nothing works (menu items, or context menu item or shortcut key). But I can see the page is acting up again: https://nowlearning.service-now.com/lxp?id=overview&sys_id=4469184fdbb024503c55818a13961923&type=course The most I can do when viewing that page is to copy the URL from the address bar. All other pages I have opened at the same time, work as expected.

Restarted with all add-ons disabled in safe mode, still no Edit -> Copy or context menu -> Copy or Ctrl+C or Ctrl+Ins.

由 Pók 於 修改

more options

double-post

由 Pók 於 修改

more options

Yes, I can only copy from the service-now page with dom.event.clipboardevents.enabled set to false. Annoying. They're using features of the Angular framework (ngCopy) to block copying.

Since I don't know how to counterprogram that, I can suggest a slightly inconvenient workaround, which is to select then text and then click a bookmark which executes a script. The script grabs the selected text and pops it into a new tab. The script does not retain the HTML, so it is similar to pasting as plain text. If you want to give it a try:

https://www.jeffersonscher.com/res/sumomarklets.html#PopSelection

more options

That's a nice trick, thanks. Do you know, now that the Help -> Submit Feedback... page functionality has been disabled, where can one submit a bug report?

more options

There are two options for bug reports:

(A) Site not working correcting in Firefox vs. other browsers:

https://webcompat.com/

(B) Firefox feature broken or needs improvement:

https://bugzilla.mozilla.org/

more options

I've recently noticed an issue when pasting images into Gmail that the image is duplicated. Not sure why but this only happens in Firefox, no other browser so I know it's not a Gmail problem...

more options

jl266 said

I've recently noticed an issue when pasting images into Gmail that the image is duplicated. Not sure why but this only happens in Firefox, no other browser so I know it's not a Gmail problem...

That's a new one. Gmail is a heavy scripted application. I'm sure they test in Firefox. Probably. Hopefully.

more options

Why the "copy only values" (Ctrl+Shft+V) function doesn't works in Excel Google Sheets files? it is incredible that a very old basic function doesn't work in the most recent Google improvements!!. I am used to work with google sheets documents due my new Job (fully remote), but, when I'm trying to copy or paste from an excel file (even from another Excel Google Sheet) this function DIDN'T WORKS!!.

if I try to do the same in Google Chrome (instead Mozilla) all the functions works perfectly, please notice that I have a old version of google chrome beacuse is not my favorite browser (doing everything whit firefox).

I need this issue resolved ASAP!

more options

franklin.perez.mata said

Why the "copy only values" (Ctrl+Shft+V) function doesn't works in Excel Google Sheets files?

Sheets is a complex, heavily scripted application. "Paste as plain text" / "Paste without formatting" has been very limited in Firefox for some time, for reasons that Google is in the best position to explain.

You probably already figured out the workarounds:

(1) Right-click (on a one-button mouse, Ctrl+click) > Paste Special > Paste values only

In my testing, this worked with many sources, but there was a problem pasting from Excel this way.

(2) Double-click to invoke editing mode and then use Ctrl+v (Mac: Command+v)

In my testing, this worked for a single cell, but not for a range.

(3) Paste into a plain text container, re-copy, then use Ctrl+v (Mac: Command+v)

In my testing, this worked, but is a hassle so you would reserve it for special cases. The plain text container could be Notepad, or another plain text editor, or a Google Sheets note.

Maybe there's a new workaround or solution since my earlier testing. (I didn't look at add-ons, for example.)

more options

same here.... when i past anything in gmail it duplicates the image

more options

t8316 said

same here.... when i past anything in gmail it duplicates the image

Hi, there is a recent issue with Gmail showing a pasted image twice. As far as I know from the other threads, that is scripted feature Google needs to fix. I don't think there's anything Firefox users can do about it for now other than delete the extra one -- and complain to Google. In case they fixed it by now but you still have the issue, try clearing Firefox's web cache to make sure old scripts are flushed and the latest ones are loaded:

How to clear the Firefox cache