I just want to block the user from taking printed copy of the web page. I know that this is not user friendly, but, this is a special scenario, an examination interface where an examinee will attempt questions in an exam. So I don't want them to take prints of the page. I have also blocked other necessary options like context menus, alt Key, save as html etc eventhough it's not good in user's specific view.
I have done it using Jquery, but the code is not working in Safari.
Code:
$(document).keydown(function(event) {
// Disable Ctrl+P.
if(!event) event = window.event;
if (event.ctrlKey && (event.which === 80)) {
event.preventDefault();
alert(event.isDefaultPrevented());
}
});
But, the alert is showing the value 'true' and then prompting with Print dialogue box. I have tried by putting return false
instead of event.preventDefault();
, then also not working. I couldn't figure out why this weird behaviour in Safari only. Please help. Thanks :)-