Is it possible to clean a tainted canvas?
I have an Openlayers map where user can add layer with CORS restriction. I can't bypass the cors by my proxy config and crossOrigin='anonymus' is not an option.
What I need, it's to be able to remove the "bad" layer and let the user produces the map image.
So I try to:
But I always get the cors error. How can I make my map great again without refreshing the browser?
No there is no way to clean a tainted canvas.
Once tainted, it will remain tainted for its whole life.
Not only this, but also drawing this canvas on a second canvas will taint that second canvas too. Even if that canvas has been completely cleared.
So, the only way for you, is to start again from a new canvas element, and to filter out the bad layers before they are drawn.