Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Tainted Canvas

Tainted Canvas

Scheduled Pinned Locked Moved JavaScript
javascripthtmlcomgame-devsysadmin
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Paulo Augusto Kunzel
    wrote on last edited by
    #1

    Hello, I've being trying to get some animations done in a canvas which are quite similar to Create an HTML5 (and JavaScript) Maze Game with a timer[^]. Unfortunately I've got the same erro that happens on the project's article. Unless you use Firefox you'll get:

    Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
    Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.

    From my research, you can add to google chrome shortcut the extension --disable-web-security or host the files in a localhost server. Both ways can make it work, but I would like to know if there is a way for cross-origin not to taint the canvas? Something like a property from the canvas that I could disable/enable or some other coding related solution..

    There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell

    enhzflepE 1 Reply Last reply
    0
    • P Paulo Augusto Kunzel

      Hello, I've being trying to get some animations done in a canvas which are quite similar to Create an HTML5 (and JavaScript) Maze Game with a timer[^]. Unfortunately I've got the same erro that happens on the project's article. Unless you use Firefox you'll get:

      Unable to get image data from canvas because the canvas has been tainted by cross-origin data.
      Uncaught SecurityError: An attempt was made to break through the security policy of the user agent.

      From my research, you can add to google chrome shortcut the extension --disable-web-security or host the files in a localhost server. Both ways can make it work, but I would like to know if there is a way for cross-origin not to taint the canvas? Something like a property from the canvas that I could disable/enable or some other coding related solution..

      There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      I sure hope not - if there was, what's to stop malicious code from loading images from your local file-system? Just use a localhost server. You can write one in c++ that compiles to a 25kb executable. Of course, you could download Apache or a different one of your choosing.

      "Science adjusts its views based on what's observed. Faith is the denial of observation, so that belief can be preserved." - Tim Minchin

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups