У меня есть html блок. хочу его скачать как картинкой. Использую html2canvas. При клике скачать открывает в новой вкладке но
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#button").click(function(){
html2canvas($("#testdiv"), {
onrendered: function(canvas) {
// canvas is the final rendered <canvas> element
var myImage = canvas.toDataURL("image/png");
window.open(myImage);
}
});
});
});
</script>
<style type="text/css">
div {
width: 150px;
background-color: #2C7CC3;
}
</style>
<div id="testdiv">
This is an image
This is an image
This is an image
This is an image
This is an image
This is an image
This is an image
This is an image
This is an image
</div>
<p id="button">Click me</p>
не качает. Посмотрите. Спасибо)
Апостиль в Лос-Анджелесе без лишних нервов и бумажной волокиты
Основные этапы разработки сайта для стоматологической клиники
Продвижение своими сайтами как стратегия роста и независимости