Announcement

Collapse
No announcement yet.

Disable right click

Collapse
X
Collapse
First Prev Next Last
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Disable right click

    Glenn I'm looking for a javascript to disable right click for a specified usergroup and forum.. I'm hoping to just add the usergroup and forum number into the code
    I know there are ways around it but that is ok
    Thank you

    #2
    Why do you want to disable right click? Generally, it's not good to disable right click just to prevent users to view the source.

    Can I disable right click on my web page without using JavaScript? I ask this because most browsers allow user to disable JavaScript. If not, how do I use JavaScript to disable right click?
    Helpful? Donate. Thanks!
    Buy me a coffeePayPal QR Code
    Fast VPS Host for vBulletin:
    A2 Hosting & IONOS

    Comment


      #3
      I have a circumstance where I made a new usergroup that I need the right click disabled in. I only want it to be disabled for a particular group.

      Comment


        #4
        Disable right click in all pages for that usergroup?
        Helpful? Donate. Thanks!
        Buy me a coffeePayPal QR Code
        Fast VPS Host for vBulletin:
        A2 Hosting & IONOS

        Comment


          #5
          yes please all pages

          Comment


            #6
            I do not personally recommend this. But since you asked...

            Code:
            <script>
            (function() {
                var usergroupids = [1, 2, 3]; [COLOR=#008000]//Specify usergroup IDs here delimited by comma[/COLOR]
                var callback = function(id) {
                    return document.querySelector('body[data-usergroupid="' + id + '"]');
                }
                if (usergroupids.some(callback)) {
                    document.addEventListener('contextmenu', function(e) {
                        e.preventDefault();
                        //uncomment the alert statement below by removing the // if you need to display an alert message.
                        //alert("Sorry, you are not allowed to do this.");
                    });
                }
            })();
            </script>
            For vBCloud customers, add the above code in the Google or Bing Ownership Verification HTML tag option in Search Engine Tools in AdminCP.
            For self-hosted customers, add the above code in the head_include template in Style Manager in AdminCP.
            Last edited by glennrocksvb; 04-26-2019, 02:02 PM.
            Helpful? Donate. Thanks!
            Buy me a coffeePayPal QR Code
            Fast VPS Host for vBulletin:
            A2 Hosting & IONOS

            Comment


              #7

              <script> (function() { var usergroupids = [22]; //Specify usergroup IDs here delimited by comma var callback = function(id) { return document.querySelector('body[data-usergroupid="22' + id + '"]'); } if (usergroupids.some(callback)) { document.addEventListener('contextmenu', function(e) { e.preventDefault(); //uncomment the alert statement below by removing the // if you need to display an alert message. //alert("Sorry, you are not allowed to do this."); }); } })(); </script>


              I'm doing usergroup 22. did I insert it into the code properly?

              Comment


                #8
                Do not remove the linebreaks in the code. If you have to, you need to remove the comments first (lines that start with //)
                Helpful? Donate. Thanks!
                Buy me a coffeePayPal QR Code
                Fast VPS Host for vBulletin:
                A2 Hosting & IONOS

                Comment


                  #9
                  Sorry I don't know what a line break is. Can you repost the code with 22 in it and I don't need any comments at this time

                  Thanks

                  Comment


                    #10
                    Just copy the code I provided as is and change just the usergroupids and nothing else.
                    Helpful? Donate. Thanks!
                    Buy me a coffeePayPal QR Code
                    Fast VPS Host for vBulletin:
                    A2 Hosting & IONOS

                    Comment


                      #11
                      Code:
                      <script>
                      (function() {
                          var usergroupids = [22]; //Specify usergroup IDs here delimited by comma
                          var callback = function(id) {
                              return document.querySelector('body[data-usergroupid="' + id + '"]');
                          }
                          if (usergroupids.some(callback)) {
                            document.addEventListener('contextmenu', function(e) {
                               e.preventDefault();
                               //uncomment the alert statement below by removing the // if you need to display an alert message.
                               //alert("Sorry, you are not allowed to do this.");
                            });
                         }
                      })();
                      </script>

                      Here is what I did and its a no go.
                      Last edited by glennrocksvb; 04-26-2019, 04:55 PM. Reason: Wrapped code in [code][/code] tags

                      Comment


                        #12
                        Is the code currently installed on your site or did you remove it? I want to see it.
                        Helpful? Donate. Thanks!
                        Buy me a coffeePayPal QR Code
                        Fast VPS Host for vBulletin:
                        A2 Hosting & IONOS

                        Comment


                          #13
                          Glenn Its back up in the Bing box

                          Comment


                            #14
                            The Bing Ownership Verification option was disabled in your AdminCP. I enabled it. You can test it now if the code works.
                            Helpful? Donate. Thanks!
                            Buy me a coffeePayPal QR Code
                            Fast VPS Host for vBulletin:
                            A2 Hosting & IONOS

                            Comment


                              #15
                              Still a no go

                              PM sent

                              Comment

                              Users Viewing This Page

                              Collapse

                              There is 1 user viewing this forum topic.

                              • Guest Guest

                              Latest Posts

                              Collapse

                              Working...
                              X
                              Searching...Please wait.
                              An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

                              Please push the back button and reload the previous window.'
                              An unexpected error was returned: 'Your submission could not be processed because the token has expired.

                              Please push the back button and reload the previous window.'
                              An internal error has occurred and the module cannot be displayed.
                              There are no results that meet this criteria.
                              Search Result for "|||"