Prevent copy past and right-click in Blackboard

1.4k Views Asked by At

I am using blackboard in my university. My students will have an exam online next month.

I am trying to prevent them to use copy, paste, select, right-click during the exam. I saw a lot of solutions using javascript.

When I used onpaste and oncopy it is work. whereas, adding the onselectstart and oncontextmenu to the code not work.

Could you please help me.

Thanks

<script type="text/javascript"> document.oncopy=new Function("return false");  document.onpaste = new Function("return false");  document.onselectstart = new Function("return false"); document.oncontextmenu = new Function ("return false"); </script>
1

There are 1 best solutions below

0
On

Make your HTML body tag like this-

<body oncopy="return false;" oncut="return false;" onpaste="return false;" oncontextmenu="return false;">
....
</body>

<body oncopy="return false;" oncut="return false;" onpaste="return false;" oncontextmenu="return false;">
  <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nesciunt natus optio odit sequi, vero, soluta inventore similique laudantium incidunt qui voluptatibus unde quod blanditiis ut facilis molestias necessitatibus, repudiandae eveniet.</p>
  <textarea rows="5" cols="30"></textarea>
</body>