Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:44:21+00:00 2026-06-04T21:44:21+00:00

Making a painting app using HTML5 and Canvas. I think I want to have

  • 0

Making a painting app using HTML5 and Canvas.

I think I want to have a similar system to applications like Paint and Photoshop where you can have a primary and secondary color selected and use left click to paint with the primary color and right click to paint with the secondary color.

However, after one releases the right mouse button the context menu in the browser is brought up (view image, save image, select all).

Can this be elegantly disabled? I don’t want it to be a hackish solution that only works on some browsers if possible.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:44:22+00:00Added an answer on June 4, 2026 at 9:44 pm

    You can use this:

    $('img').bind('contextmenu', function(e){
        return false;
    }); 
    

    See this working example!

    With the lastest jQuery:

    $('body').on('contextmenu', 'img', function(e){ return false; });
    

    Note: You should use something narrower than body if possible!

    Or without jQuery, applying on canvas:

    canvas.oncontextmenu = function(e) { e.preventDefault(); e.stopPropagation(); }
    

    EDITED

    Updated the Fiddle Example to show the contextmenu being limited to the canvas and not the image.

    JQUERY

    $('body').on('contextmenu', '#myCanvas', function(e){ return false; });
    

    HTML EXAMPLE

    <canvas id="myCanvas" width="200" height="100">
      Your browser does not support the canvas element.
    </canvas>
    
    <img src="http://db.tt/oM60W6cH" alt="bubu">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a paint project like photoshop using c#. I have used GDI+
I'm making a simple painting app, and it's my first time using the canvas.
I have a canvas in HTML5 and am making a networked painting application. However,
I'm making a painting app, and I currently have the app at a point
I'm making something like an augmented reality app, in which I have an OpenGL
Hi I'm painting an image onto a canvas (html5) and I want to reduce
I have designed a system that is made up of 3 separate applications: Web
I am making a finger painting app and I am having a hard time
I'm making an iPad app. In the app I have multiple UITextViews. I've already
I'm making a paint program to paint on 3D meshes using a circular brush.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.