Skip to content

Instantly share code, notes, and snippets.

@omarrr
Last active December 22, 2015 08:29
Show Gist options
  • Select an option

  • Save omarrr/6445056 to your computer and use it in GitHub Desktop.

Select an option

Save omarrr/6445056 to your computer and use it in GitHub Desktop.

Revisions

  1. omarrr revised this gist Sep 5, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion screen-capture-fix.js
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ function downloadCapture(forceDownload)
    if (forceDownload)
    image = image.replace("data:image/png;base64", "data:application/octet-stream;base64");

    window.open(image);
    window.open(image, "_blank");
    }

    // If you'd rather save the image directly, change the value for 'true'
  2. omarrr revised this gist Sep 5, 2013. 1 changed file with 6 additions and 12 deletions.
    18 changes: 6 additions & 12 deletions screen-capture-fix.js
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,13 @@
    function downloadCapture(forceDownload)
    {
    var canvas = document.getElementById("canvas");
    if (canvas.getContext) {
    var ctx = canvas.getContext("2d");
    var image = canvas.toDataURL("image/png");
    var image = canvas.toDataURL("image/png");

    if (forceDownload)
    image = image.replace("data:image/png;base64", "data:application/octet-stream;base64");
    if (forceDownload)
    image = image.replace("data:image/png;base64", "data:application/octet-stream;base64");

    window.open(image);
    }
    else {
    console.log("something went _really_ wrong.")
    }
    window.open(image);
    }

    // If you'd rather open the image in a new tab, change 'true' for 'false'
    downloadCapture(true);
    // If you'd rather save the image directly, change the value for 'true'
    downloadCapture(false);
  3. omarrr created this gist Sep 5, 2013.
    19 changes: 19 additions & 0 deletions screen-capture-fix.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    function downloadCapture(forceDownload)
    {
    var canvas = document.getElementById("canvas");
    if (canvas.getContext) {
    var ctx = canvas.getContext("2d");
    var image = canvas.toDataURL("image/png");

    if (forceDownload)
    image = image.replace("data:image/png;base64", "data:application/octet-stream;base64");

    window.open(image);
    }
    else {
    console.log("something went _really_ wrong.")
    }
    }

    // If you'd rather open the image in a new tab, change 'true' for 'false'
    downloadCapture(true);