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 465119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:20:39+00:00 2026-05-12T23:20:39+00:00

Well not just IE, any browser that doesn’t currently support it I want to

  • 0

Well not just IE, any browser that doesn’t currently support it

I want to start using the processing.js framework. It’s used for making images with the canvas element. However I’m reluctant to use it due to the fact that it’s not widely supported.

So what’s the best way for me to give the user an alternative image if they do not support the canvas element?

I’d need something like…

if(!canvas){
    element.style.backgroundColor = 'red';
}

Is there a standardised way of doing this yet? If not what’s the best thing I could do?

  • 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-05-12T23:20:39+00:00Added an answer on May 12, 2026 at 11:20 pm

    Any content between the <canvas></canvas> tags will be displayed if the canvas element is not supported. So you can try:

    <canvas><img src="alt-image-for-old-browsers.png" /></canvas>
    

    The logical thing that comes to mind is to place the JavaScript you want to run between the <canvas></canvas> tags:

    <canvas>
      <script>
      document.getElementById('element').style.backgroundColor = 'red';
      </script>
    </canvas>
    

    But alas this doesn’t work. Even browsers that support the Canvas API will execute the script.

    So perhaps the best thing you can do to programatically check that the browser supports the canvas API is to check the getContext method available on all <canvas></canvas> elements:

    function supportsCanvasAPI() {
      var canvas = document.createElement('canvas');
      if (window.G_vmlCanvasManager) { // IE ExplorerCanvas lib included?
        G_vmlCanvasManager.initElement(canvas);
      }
      return 'getContext' in canvas
    }
    

    That creates a dummy canvas (so as to not worry about grabbing a reference to one in the DOM already) and checks if the getContext property exists on the element. It also checks to see if ExplorerCanvas has been included for IE. It won’t tell you exactly what features of the API are supported (beyond the standard set of shapes, paths, etc).

    An article on feature-detecting HTML5 features (like canvas) can be found here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just realized that this piece of code works well in Firefox but not
An image is not showing up on any browser for me. I'm pretty sure
I'm parsing a (not well formed) Apple Plist File with java. My Code looks
My question is probably not well phrased and it's probably a dupe but here
I'm being handed some data which is not well defined and subject to change
Suppose i have the code snippet as follows : ( clarification purpose/not well formed
http://www.programmersheaven.com/2/FAQ-ADONET Disconnected architecture is not well suited for desktop clients with multiple updates but
I need to use basic javascript here and I'm not well versed with it.
I've been getting parser error with message The server tag is not well formed
I'm trying to make a design decision. I'm not well acquainted with either MongoDB

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.