I have a browser application, and I have a select box. This select box normally is available for interaction, but I need to hide it in case that it is locked down. For that, I have set up several security layers:
1: Javascript
// The underneathprevents right-click aswell as other inspect element interactions
// Wait for document to be ready before doing JS / Jquery magic
$(document).ready(function () {
$(document).bind("contextmenu", function (e) {
e.preventDefault();
});
$(document).keydown(function (event) {
if (event.keyCode === 123) { // Prevent F12
return false;
} else if (event.ctrlKey && event.shiftKey && event.keyCode ===
73) { // Prevent Ctrl+Shift+I
return false;
}
});
elem.hide(): // prevents the user to see it
2: The problem is:
When a user sets JS in chrome to be disabled, he can access inspect element and then remove the hidden/disabled attribute from a button. Is there any way this security issue can be tackled?