We're using Confluence 5.9.I want to put oncontextmenu='return false' in the video tag to prevent the video right click. How can I put it in?
Hello JinDooHwan,
Thank you for reaching out! I'm happy to help.
I would recommend adding the text into your <video tag itself:
<span>oncontextmenu</span><span>=</span><span>"</span><span>return</span> <span>false</span><span>;</span><span>"</span>
You can also embed javascript on the page, like this:
<span> $</span><span>(</span><span>document</span><span>).</span><span>ready</span><span>(</span><span>function</span><span>()</span> <span>{</span><span> $</span><span>(</span><span>"video"</span><span>).</span><span>bind</span><span>(</span><span>"contextmenu"</span><span>,</span><span>function</span><span>(){</span> <span>return</span> <span>false</span><span>;</span> <span>});</span> <span>}</span> <span>);</span>
This would prevent right-click on any video elements on that page. If you are unsure on how to add code to a Confluence page, have a look at How to Use Javascript in Confluence.
One more thing that you need to be aware of, and this is very important. Your Confluence version of 5.9 reached End of Life in November of 2017. It is at very high risk of being compromised, due to the following security advisories, explained below:
You'll need to make sure that you upgrade as soon as possible to the latest version of Confluence. For details on how to do that, have a look at our Confluence Installation and Upgrade Guide.
Thank you for your understanding!
Regards,
Shannon
<script type="text/javascript"> $(document).ready(function() { $("video").bind("contextmenu",function(){ return false; }); } );</script>
I put the code in Custom HTML.
But it doesn't work. Help me.
Hi there,
Thank you for following up!
I'm very sorry that I didn't include this in my example, but according to the document I sent you, How to Use Javascript in Confluence, you have to call AJS before any query.
I would recommend the Multimedia Macro for this, as it won't work the same if you're just using the attachments macro.
The script as follows:
<script type="text/javascript">AJS.toInit(function(){AJS.$("video").bind('contextmenu',function() { return false; });});</script>
Can you give that a try and let us know how it goes?
Thank you for your answers.
It does not work in the #document.
@DooHwan JIN
hello
if you solved this problem ..?
I have the same problem please help me...
It looks like you're new here. Sign in or register to get started.