Tainted canvases may not be exported

后端 未结 10 1663
被撕碎了的回忆
被撕碎了的回忆 2020-11-22 05:21

I want to save my canvas to a img. I have this function:

function save() {
    document.getElementById(\"canvasimg\").style.border = \"2px solid\";
    var d         


        
10条回答
  •  我在风中等你
    2020-11-22 06:13

    Just as a build on @markE's answer—if you want to create a local server. You won't have this error on a local server.

    If you have PHP installed on your computer:

    1. Open up your terminal/cmd
    2. Navigate into the folder where your website files are
    3. While in this folder, run the command php -S localhost:3000 ← Notice the capital 'S'
    4. Open up your browser and in the URL bar go to localhost:3000. Your website should be running there.

    or

    If you have Node.js installed on your computer:

    1. Open up your terminal/cmd
    2. Navigate into the folder where your website files are
    3. While in this folder, run the command npm init -y
    4. Run npm install live-server -g or sudo npm install live-server -g on a mac
    5. Run live-server and it should automatically open up a new tab in the browser with your website open.

    Note: remember to have an index.html file in the root of your folder or else you might have some issues.

提交回复
热议问题