Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to take the full-page screenshots of a web-page, but in chunks of only visible view recursively. I am using the following code to take a screenshot of the full page.

What I have tried:

Here is my code for the same:-
JavaScript
var imgTxt; 

function genScreenshot() {
    html2canvas(document.body, {
        onrendered: function(canvas) {

            if (navigator.userAgent.indexOf("MSIE ") > 0 || navigator.userAgent.match(/Trident.*rv\:11\./) !== null) {
                var blob = canvas.msToBlob();
                blobData = blob;
                // window.navigator.msSaveBlob(blob,'Test file.png') ;       
                makeAjaxRequest("http://localhost:53065/Quote", blob);

                // imgTxt=canvas.toDataURL("image/jpeg");
                // makeAjaxRequest("http://localhost:53065/Quote",imgTxt);
            } else {
                //  canvas.toBlob(function(blob){
                //  blobData = blob;
                //  console.log(blob);
                //  console.log(blobData);
                // },'image/png');

                imgTxt = canvas.toDataURL("image/jpeg");
                makeAjaxRequest("http://localhost:53065/Quote", imgTxt);
            }
        }
    });
}

Also, can somebody tell me how I can send the same as a blob instead of a DataURL string?
Posted
Comments
[no name] 14-Dec-19 12:13pm    
A web page that takes screen shots? Don't see it happening. It would be a security hole if it could.
AbhiAbzs 20-Jan-20 8:57am    
Actually it was a part for a functionality required by the client & there can be several use case for the same. For example, a site for drawing some text & then saving it to cloud for user, various complete website screen capture, tools that are achieved by various extensions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900