Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross domain and SVG not work #9

Closed
brcontainer opened this issue Sep 20, 2014 · 1 comment
Closed

Cross domain and SVG not work #9

brcontainer opened this issue Sep 20, 2014 · 1 comment

Comments

@brcontainer
Copy link
Owner

Note: This question/issue has been established to guide proxy servers.

If my html/script is on a domain like this http://www.example.com and the proxy in another like this http://proxy.example.com (or http://www.example2.com) the script fails to convert the images to canvas, see example:

<script>
//<![CDATA[
(function() {
    window.onload = function(){
        html2canvas(document.body, {
            "logging": true, //Enable log (use Web Console for get Errors and Warnings)
            "proxy":"http://proxy.example.com/html2canvasproxy.php", //or  "proxy":"http://www.example2.com/html2canvasproxy.php"
            "onrendered": function(canvas) {
                var img = new Image();
                img.onload = function() {
                    img.onload = null;
                    document.body.appendChild(img);
                };
                img.src = canvas.toDataURL("image/png");
            }
        });
    };
})();
//]]>
</script>

Script show this error:

Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': tainted canvases may not be exported.

And the proxy don't support SVG images.

@brcontainer
Copy link
Owner Author

Enhancements applied in 0.1.10 version b30f496

Read how to use "cross-domain":
https://github.com/brcontainer/html2canvas-php-proxy/#run-script-in-cross-domain-data-uri-scheme

@brcontainer brcontainer changed the title Cross domain and sub-domain not work Cross domain and SVG not work Sep 20, 2014
Repository owner locked and limited conversation to collaborators Sep 20, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant