Angular 7: Disable right-click and highlight on <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>

Habilidades: CSS, HTML5, PDF, Typescript

Veja mais: disable right click mouse globally vba, disable right click flv, vb6 webbrowser disable right click, angular 4 stoppropagation, angular 5 stoppropagation, angular 4 stop event propagation, angular 2 stoppropagation not working, event.stoppropagation is not a function angular 2, how can i prevent text/element selection with cursor drag, event stoppropagation angular 4, angular 6 stop event propagation, 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

Acerca do Empregador:
( 1 comentário ) Antelope, United States

ID do Projeto: #19243152

Concedido a:


Hello It's a piece of cake. I can help you to do it perfectly. If you hire me, i can start right now, and i will do my best for us. Thanks.

$30 USD em 1 dia
(1 Comentário)

4 freelancers estão ofertando em média $27 para esse trabalho


Hi, I am Anshul, a Full Stack Developer with experience in technologies like Java, Angular, Node, React, etc. I have been working since last 4 years, started as an intern in a startup that ended up being one of t Mais

$20 USD em 1 dia
(0 Comentários)

"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 Mais

$34 USD in 7 dias
(0 Comentários)

Hi, I have reviewed your job requirements and I am interested in this project and can easily complete this job in minimum time possible with guaranteed results. I am an expert data entry specialist as well as a s Mais

$25 USD em 1 dia
(0 Comentários)