0
Google지도가있는 페이지가 있고 div가 몇 개 있습니다. 사용자에게 "Screenshot Grab Screenshot"버튼을 클릭해야합니다. 저장해야합니다. 사용자 페이지의 스크린 샷을 만들고 서버에 저장하십시오. 나는 연구, 나는 그것이 어떤 CORS의 문제가 발견 않았다ASP.net의 서버에 이미지로 캔버스 저장하기
function GenerateImage()
{
html2canvas($('#mainDiv'), {
onrendered: function(canvas) {
//this appends the canvas(screenshot) to the page, this is working fine
document.body.appendChild(canvas);
//this is not working,
//Error: SecurityError: The operation is insecure.
var image = canvas.toDataURL('image/png');
image.crossOrigin = 'anonymous';
var imgdata = image.replace(/^data:image\/(png|jpg);base64,/, '');
$.ajax({
url: '******',
data: {
imgdata:imgdata
},
type: 'post',
success: function (response) {
console.log('Success');
}
});
}
});
}
:
내가 Html2Canvas을 시도하지만 내 자바 스크립트 함수에 dataurl 예에 캔버스를 변환 할 수 허용하지 않습니다, 나는 이것을 사용 그러나 나는 해결책을 찾아 낼 수 없다.
ASP.net을 사용하여 스크린 샷을 만들 수 있는지 궁금한가요? 미리 감사드립니다.
시도해 볼 수 있습니다. https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob –
응답 해 주셔서 감사 드리며,이 오류도 발생했습니다. 잡히지 않았습니다. SecurityError : 'HTMLCanvasElement'에서 'toBlob'을 (를) 실행하지 못했습니다. 오염 된 캔버스를 내보낼 수 없습니다. – lambda8
볼 수 있습니다 ... http://stackoverflow.com/questions/16235161/save-current-google-map-as- 영상. 어쩌면 당신은 useCORS 누락 : 사실 –