html2canvas是无法解析的函数或方法

时间:2019-06-23 15:34:06

标签: javascript php html2canvas

尝试使用html2canvas从网页获取屏幕截图。附带的代码是我使用的功能。运行时出现502网关错误。 html2canvas函数是未解决的函数或方法。该怎么解决?

<head>
    <title>PHP Test</title>
    <script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
    <script src ="html2canvas.js" type="text/javascript"></script>
    <script>
        function capture(){
            const element = $("#logo"); //this is the html element whose screenshot we want to take
            html2canvas(element,{
                background:'#FFFFFF',
                onclone:function(canvas{
                    var imgData = canvas.toDataURL('image.png');
                    $.ajax({
                        url:'save.php', // save.php is the php script to save the captured screnshot to server
                        type:'post',
                        dataType : 'text',
                        data:{
                            base64data : imgData
                        }
                    })
                })
        })
        }
    </script>
</head>

0 个答案:

没有答案