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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:37:55+00:00 2026-05-27T09:37:55+00:00

Is there a quick test to determine if a browser supports CORS-enabled images not

  • 0

Is there a quick test to determine if a browser supports CORS-enabled images not tainting a canvas when drawn on them. I know Chrome 15 supports this, Firefox 9Beta but not Firefox 8, Safari doesn’t, IE9 doesn’t. But there must be a pretty simple test to determine this, is basically drawing on a canvas with an image and seeing if you get an exception when you try to get image data, or is there any other easy way to determine this.

  • 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-27T09:37:56+00:00Added an answer on May 27, 2026 at 9:37 am

    Here is how I tested for CORS tained canvas support. If someone has a way without having to load an image, please post it here:

    function CanvasFunctions() {
        var _initialized = false, _corsNotSupported = false;
    
    
        function DrawImage(image, src) {
            jQuery.when(initialized()).then(function () { 
                if (_corsNotSupported) {
                   image.src = GetProxyImage(src);
                } else {
                   image.src = src;
                } 
            }
        }
    
        function initialized() {
            if (_initialized) {
                return true;
            }
    
            var dfd = $.Deferred();
    
            var src = 'http://example.com/corsImage.jpg',
                image.onload = function () {
                    var canvas = document.createElement('canvas');
                    canvas.width = 250;
                    canvas.height = 250;
                    var ctx = canvas.getContext('2d');
                    ctx.drawImage(image, 0, 0, 200, 200);
                    try {
                        var hit = ctx.getImageData(0, 0, 1, 1).data[3] > 1;
                        console.log('Canvas was not tainted by CORS image, hit: ' + hit);
                    } catch (e)  {
                        console.log('Canvas was tainted by CORS image, reverting to passthru for images');
                        _corsNotSupported = true;
                    }
                    _initialized = true;
                    dfd.resolve(true);
                });
    
            image.src = src;
    
    
            return dfd.promise();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a quick and easy way to test a gem which is already
Is there a good rule of thumb or test I can perform to determine
Is there quick way to get the ImageFormat object associated to a particular file
Is there a quick one-liner to call datepart in Sql Server and get back
Is there a quick way to join paths like the Join-Path function in Powershell?
Is there a quick & dirty way of obtaining a list of all the
Is there a quick way to find every match of a regular expression in
Is there a quick tcpdump one-liner to print out a TCP stream that matches
is there a quick way to sort the items of a select element? Or
Is there a quick-and-dirty way to tell programmatically, in shell script or in Perl,

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.