Skip to content

Commit 41d2d10

Browse files
authored
Disable copy paste on portal pages (#2479)
* Add script to display user mentions in Service Portal This script retrieves and displays the top 5 records where the logged-in user is mentioned, providing links to those records. * Delete Modern Development/Service Portal Widgets/My Mentioned Items directory * Create script.js * Delete Modern Development/Service Portal Widgets/My Mentioned Items directory * Create script.js * Delete Server-Side Components/Scheduled Jobs/Retire Rating 1 Articles directory * Create script.js * Create README.md
1 parent d11c0aa commit 41d2d10

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**Steps to Activate**
2+
1. Open the portals you want to disable copy/paste operation in "sp_portal" table.
3+
2. Open the theme attached to the portal.
4+
In the theme under "JS Includes" relatd list, create new JS include and select the UI script you created. Go to your portal and try to copy/paste in any catalog item field or any text field on portal.The operation will be prevented with the alert message.
5+
6+
**Use Case**
7+
1. Many high security organizations like banks do not want the users to copy paste account number or passwords to ensure safety.
8+
2. Many input form want the users to re-enter the password or username without copying from other fields.
9+
10+
This UI script is applied through portal theme , so it will be specific to portals using that theme. It will not have instance wide affect.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
Disable Copy Paste on Portal Pages.
3+
UI Type : Service Portal/Mobile.
4+
*/
5+
document.addEventListener('copy', function(e) { //event listner for copy.
6+
alert("Copy Operation is prevented on this page."); // alert for copy
7+
e.preventDefault(); // prevent copy
8+
});
9+
10+
document.addEventListener('paste', function(e) { //event listner for paste.
11+
alert("Paste Operation is prevented on this page."); //alert for paste
12+
e.preventDefault(); // prevent paste
13+
});

0 commit comments

Comments
 (0)