Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want to put oncontextmenu='return false' in the video tag

DooHwan JIN April 29, 2019

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?

image.png

2 answers

2 votes
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 1, 2019

Hello JinDooHwan,

Thank you for reaching out! I'm happy to help.

I would recommend adding the text into your <video tag itself:

oncontextmenu="return false;"

You can also embed javascript on the page, like this:

 $(document).ready(function() {
    $("video").bind("contextmenu",function(){
        return false;
        });
 } );

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

DooHwan JIN May 1, 2019

<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.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 3, 2019

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?

Regards,

Shannon

DooHwan JIN May 6, 2019

#document.PNG

Thank you for your answers.

It does not work in the #document.

Like Luis Rodrigo Tayupanda likes this
DooHwan JIN May 10, 2019

@Shannon S 

The method in confluence version 5.9 is required....

Like Luis Rodrigo Tayupanda likes this
Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 10, 2019

JinDooHwan,

The script has been tested to work with the multimedia macro, but it appears that from your script, you're trying to use an iFrame. Can you test using the Multimedia Macro and let me know how it goes?

Secondly, I would really advise against you remaining on version 5.9. It is imperative that you upgrade from the Confluence 5.9 version as soon as you possibly can. Your instance is at extreme risk until you upgrade.

Thank you for your understanding.

Regards,

Shannon

DooHwan JIN May 12, 2019

@Shannon S 

We used multimedia macros.
Script not applied.

Shannon S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2019

From your reply, when you say "script not applied" I believe you mean that you did apply it, but it did not work as expected. Is this correct?

As we tested this to work on 6.6, I would recommend that you first do the upgrade as required, and then you can test the script again, and see if it works there.

Let us know if you have any trouble!

Regards,

Shannon

0 votes
Luis Rodrigo Tayupanda
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 18, 2022

@DooHwan JIN 

hello 

if you solved this problem ..?

I have the same problem please help me...

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events