Disable right-click and highlight on this <object> element without disabling scrolling

I have an <object> element (see below) into which a PDF is being loaded. Currently, users can simply right-click on it and download it in Chrome. Firefox even shows a download button.

I want to prevent users from downloading the PDF, so I want to disable right-click, and I also want to prevent them from highlighting and copying the text. And since <object> elements don't respond to click events, I am handling the click event in the <div> below it with (contextmenu)= "myFunction()".

The problem is that disabling right-click in this way also disables scrolling for some reason. So does style="pointer-events: none". I need to disable right-clicks and highlighting on the PDF but the user still needs to be able to scroll to view the pages below.

I am using Angular 7 so this is being done with HTML and Typescript. The PDF file is coming from Firebase Storage.

<object width="100%" height="690" type="application/pdf" [data]="([login to view URL])">

<div style="position:absolute; top:0; left:0; bottom:0; right:0;" (contextmenu)="onRightClick($event)"></div>

Skills: CSS, HTML5, Javascript, PDF, Typescript

See more: disable text selection html, css remove blue highlight on click, remove blue border on click, javascript prevent highlight, how can i prevent text/element selection with cursor drag, css user-select, css disable mobile click highlight, css remove highlight on click, disable right click mouse globally vba, disable right click flv, vb6 webbrowser disable right click, vb6 disable right click mouse windows, disable right click javascript cartweaver, iframe disable right click iframe, disable right click iframe, disable right click actionscript, disable right click mouse windows, disable right click firefox iframe, webbrowser disable right click, html iframe disable right click

About the Employer:
( 2 reviews ) Antelope, United States

Project ID: #19242121

11 freelancers are bidding on average $29 for this job


Hello there, I am interested and ready to start. I will do this in 2 Hours. Please visit our profile reviews to make confidence working with us looking More

$30 USD in 0 days
(91 Reviews)

Hello hiring member i am bhavika i have 3+years experience in php , laravel , ajax ,html ,css , bootstrap so i can do it and i can start it right now so please give me chance to serve you thanks in advance :)

$30 USD in 1 day
(77 Reviews)

Hi, Your requirements are fully clear to me and I am applying only because I meet all the requirements that you are looking for. I have been working as a wordpress developer and designer for more than 6 years and I More

$25 USD in 1 day
(18 Reviews)

Hello, Thanks for posting your requirements over here. As per my understanding, you are looking for someone who can disable right click and highlighting and copying the text. We can help you to disable right c More

$40 USD in 1 day
(1 Review)

Hi, ⭐⭐My understanding⭐⭐ You need experienced chrome extension developer. I believe, I can do this with ease as i have much experience in chrome development and created 30+ chrome extensions in different domain More

$30 USD in 1 day
(9 Reviews)

Hello, I am an angular expert. I am working as a frontend developer at an MNC for more than 4 years. And in these year I have worked on large scale on going projects as well as created the projects from scrat More

$20 USD in 1 day
(1 Review)

"Hi, Hope you are doing well! Thanks for sharing your project requirement with us. It will be our great pleasure to work on your project. I have checked your requirement, yes we can do it, because we already work on si More

$34 USD in 7 days
(0 Reviews)

Skilled and Friendly WEB DEVELOPER. FAST WORK & HIGH QUALITY! IMAGINE that, If YOU hire ME you will get the BEST & FAST services.

$35 USD in 2 days
(0 Reviews)
$15 USD in 3 days
(0 Reviews)

Hey, I saw your job posting for "Disable right-click and highlight on this <object> element without disabling scrolling" and believe that I have the right skills and temperament for it. Let me introduce myself. More

$30 USD in 1 day
(0 Reviews)

I can able to solve this issue. I already worked in javascript and Angular versions. Please give all the required details so that I can solve this with in a day

$25 USD in 1 day
(0 Reviews)