簡體   English   中英

html2canvas插件無法捕獲圖像

[英]html2canvas plugin not capturing image

之前曾有人問過這個問題,但我似乎無法解決這個問題。 希望你能看到我的方式的錯誤。 下面的代碼將捕獲文本和灰色div,但不捕獲圖像。

<div id="snapshot" style="left: -60px; height: 1000px; width: 1000px;">
    <p>THIS IS A TEXT TEST</p>
    <div style="width: 100px; height: 100px; float: left; background: #f0f0f0">

    </div>

    <img src="http://photos.capturemyarizona.com/photos/LnnOEyWSV4fh846ohaIAQg/display.jpg" />
</div>




$("#myBtn").click ->
    html2canvas $("#snapshot"),
      background: "red"
      onrendered: (canvas) ->
        imgSrc = canvas.toDataURL()
        popup = window.open(imgSrc)
        return

    return


<button id="myBtn">Click Me</button>

這是小提琴 jsfiddle

好的,我知道問題出在哪里。 html2canvas如果不是來自同一來源,則無法捕獲圖像。 我的圖像來自CDN。

html2canvas文件

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM