Skip to content

Commit f1f5267

Browse files
authored
Prevent Right Click on Portal pages (#2060)
* Create test.js * Delete Specialized Areas/Fix scripts/test.js * Create Prevent Right-Click On Portals.script.js * Delete Client-Side Components/UI Scripts/Prevent Right-Click On Portals.script.js * Create script.js * Create README.md * Update script.js * Update README.md
1 parent 986a78e commit f1f5267

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
**Steps to Activate**
2+
1. Open the portals you want to disable right-click in "sp_portal" table.
3+
2. Open the theme attached to the portal.
4+
3. In the theme under "JS Includes" relatd list, create new JS include and select the UI script you created.
5+
Go to your portal and try to roght click, it will prevent and show the alert message.
6+
7+
**Use Case**
8+
1. Many high security organizations like banks do not want their images or links to be copied through "inspect" so right-click need to be disabled.
9+
2. Many organizations want their source code to be hidden so they prevent right-click.
10+
11+
12+
**Note**
13+
1. 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+
Prevent right-click on portal for portal pages.
3+
This will secure the site code, prevent users from saving images etc.
4+
Ideal for high security organisations.
5+
6+
UI Type : Mobile/service portal.
7+
*/
8+
(function() { // self invoking function
9+
document.addEventListener('contextmenu', function(event) {
10+
event.preventDefault(); // Prevent right-click operation.
11+
alert("Right-Click Prevented for Security Reasons."); // alert message shown on right click.
12+
});
13+
})();

0 commit comments

Comments
 (0)