Hello,
I麓m using html2canvas with Wordpress. It works fine on every desktop/android device but iOS is not working. I have tested iPhone SE (iOS 11.2.1) Safari/Chrome and iPad 2 (iOS 9.3.5) Safari/Chrome. I麓m using 1.0.0-alpha.9 html2canvas. It returns only white background as img. You can test it here - http://konf.inforadar.sk - "Ulo啪it do galerie" is a save to gallery button and in top right corner is a gallery (galeria).
Code:
<script src="inc/html2canvas.min.js"></script>
<script type="text/javascript">
jQuery(document).on("click", "#vpc-add-to-cart", function(event) { takeScreenshot(); event.stopImmediatePropagation(); } );
function takeScreenshot() {
var element = jQuery("#vpc-preview")[0];
html2canvas(element, { "background": "#FFFFFF" }).then(function(canvas) {
var imgData = canvas.toDataURL('image/jpeg',1.0);
jQuery.ajax({
url: 'gallery/save.php',
type: 'post',
dataType: 'text',
data: { base64data: imgData }
});
window.alert('Ulo啪eno!');
});
}
</script>
Any advice? Thank you very much!
Having the same problem. Any advice on this?
Best regards.
sam problem.
Same problem
I have the same problem now, have you a idea of the problem ,guys ? Thank you.
similar bug, not work.
iPhone 6 with IOS 11.2.1
iPhone X (unknow version
same problem
Yes, I have the same problem. I hope someone can solve it.
same problem
same
Have the same problem.
Have the same issue
Someone has a fix for it. Please share.
any updates on this?
found this solution.
var s = document.createElement("script");
if(isSafari()){
s.src = "https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-alpha1/html2canvas.min.js";
}else{
s.type = "text/javascript";
s.src = "js/scripts/html2canvas.js"; // version html2canvas 1.0.0-rc.7
}
$("head").append(s);
https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-alpha1/html2canvas.min.js
seems to be working on safari/IOS devices but not on chrome/android
@msbir
Thanks for sharing this solution. For Safari, it's working now with [ 1.0.0-rc.7 js]
Is there is any generic library for both browsers? Currently, I'm using this library for Android and IOS [ Chrome and Safari ] for hybrid mobile application.
Now to achieve this I'm loading 2 different html2canvas.min.js. If you could share common js [ CDN link ] which support both platforms it will be very helpful to optimize the app.
Most helpful comment
found this solution.
https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.5.0-alpha1/html2canvas.min.js
seems to be working on safari/IOS devices but not on chrome/android