jquery - Html2canvas - 在phonegap应用程序中捕获谷歌地图到图像

标签 jquery html cordova html2canvas

我想捕获带有叠加层的谷歌地图到图像以供将来使用。我刚刚尝试使用 html2canvas,例如

 html2canvas($('#map'), {
                        useCORS: true,
                        onrendered: function(canvas) {
                           document.body.appendChild( canvas );
                        }
 });

这在 Chrome 和 FF 等桌面浏览器上运行良好。然而,在phonegap应用程序中,它只是创建带有 map 缩放按钮等的图像。但是 map 图 block 丢失了。只有 map 控件在那里。

最佳答案

明白了..:)

添加allowTaint:true

html2canvas($('#map'), {
                        useCORS: true,
                        allowTaint:true,
                        onrendered: function(canvas) {
                           document.body.appendChild( canvas );
                        }
 });

关于jquery - Html2canvas - 在phonegap应用程序中捕获谷歌地图到图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22530593/

相关文章:

android - Cordova 振动不工作

ios - Cordova 更新后未删除加载微调器

cordova - cordova gigya 和 cordova googleplus 插件中的 WEB_APPLICATION_CLIENT_ID 和 GOOGLE_IOS_CLIENT_ID 是什么

javascript - Jquery FadeIn/FadeOut 太突兀

javascript - 基于链接域创建模态窗口

javascript - 如何在不修改模板的情况下在Google Blogger中添加jQuery?

javascript - 如何确保用户只能删除特定记录?

jquery - 如何在 jQuery 中重复执行一组元素?

jquery - 将过渡淡入淡出应用到 css jQuery 中的粘性导航

html - CSS 更改按钮悬停颜色