Tìm kiếm hỗ trợ

Tránh các lừa đảo về hỗ trợ. Chúng tôi sẽ không bao giờ yêu cầu bạn gọi hoặc nhắn tin đến số điện thoại hoặc chia sẻ thông tin cá nhân. Vui lòng báo cáo hoạt động đáng ngờ bằng cách sử dụng tùy chọn "Báo cáo lạm dụng".

Learn More

javascript prevents paste

  • 8 trả lời
  • 30 gặp vấn đề này
  • 154 lượt xem
  • Trả lời mới nhất được viết bởi barry1m

more options

Certain websites use a script to prevent pasting from the clipboard into a text box. Neither cntl-v nor the context menu work. Using Noscript prevents some sites from working.

eg using the page given I cannot paste an email address and login.

Does any one know a workaround?

Certain websites use a script to prevent pasting from the clipboard into a text box. Neither cntl-v nor the context menu work. Using Noscript prevents some sites from working. eg using the page given I cannot paste an email address and login. Does any one know a workaround?

Giải pháp được chọn

I hadn't checked the code and doing that I notice that there are attributes set to disable a lot of 'on' events for those fields.
You can remove them with this bookmarklet to make pasting work (and copy/cut).
It also enabled the context menu.


javascript:(function(){var a=['oncopy','oncontextmenu','oncut','onpaste'],e=['logonIdField','logonPasswordField'],i,j;for(i=0;e[i];i++){if(E=document.getElementById(e[i])){for(j=0;A=a[j];j++){E.removeAttribute(A);}}}})();
Đọc câu trả lời này trong ngữ cảnh 👍 1

Tất cả các câu trả lời (8)

more options

Try with no-script disabled.

Resort to pen and paper, write down the email address, then reading from the piece of paper type it into the email address box on Waitrose's site.

more options

Tools > Options > Content : JavaScript > Advanced > Allow Scripts to:
[] "Disable or replace context menus"


more options

These answers do not solve the problem.

Example Site Affected:

https://www.waitrose.com/shop/InitiateLogin?

Tools > Options > Content : JavaScript > Advanced > All the "Allow Scripts to" entries are deselected.

Perhaps I should have put these details in the main body of the question instead of "More system details..."

I do get the context menu when left-clicking in the box, but the the paste function has no effect. (Allowing "Disable or replace context menus" kills the context menu altogether)

more options

Do these Websites work in Firefox Safe Mode ??

Troubleshooting extensions and themes

Clipboard not working

Check and tell if its working.

more options

Giải pháp được chọn

I hadn't checked the code and doing that I notice that there are attributes set to disable a lot of 'on' events for those fields.
You can remove them with this bookmarklet to make pasting work (and copy/cut).
It also enabled the context menu.


javascript:(function(){var a=['oncopy','oncontextmenu','oncut','onpaste'],e=['logonIdField','logonPasswordField'],i,j;for(i=0;e[i];i++){if(E=document.getElementById(e[i])){for(j=0;A=a[j];j++){E.removeAttribute(A);}}}})();
more options

Thank you! Your js bookmarklet solves the problem. This begs the question - why does the setting forbidding sites to "Disable or replace context menus" allow the context menu, but doesn't allow it to do anything (at least not paste). Perhaps FF4 has solved this?

more options

You're welcome.

The setting about the context menu in Options only affects the context menu and not other 'on' events like done on this specific page. Other sites may use different code to do things like this and it is actually done most of the time by a script that runs globally on the page and not as in this case by adding them as attributes to the input elements.

more options

I've discovered another way of enabling the paste function which may be easier to implement for most users. Install the FF Add-on RightToClick. It has a toolbar button to enable paste and works on the site I cited.