
解決方法就是把 ctx.drawImage( "這邊帶入的物件", 0, 0);
帶入的物件的crossOrigin屬性要設為anonymous
※ 必須在一開始就要加上anonymous
ex:


The insertAdjacentHTML() method parses the specified text as HTML or XML and inserts the resulting nodes into the DOM tree at a specified position. It does not reparse the element it is being used on, and thus it does not corrupt the existing elements inside that element. This avoids the extra step of serialization, making it much faster than direct innerHTMLmanipulation.
element.insertAdjacentHTML(position, text);
positionDOMString representing the position relative to the element; must be one of the following strings:'beforebegin': Before the element itself.'afterbegin': Just inside the element, before its first child.'beforeend': Just inside the element, after its last child.'afterend': After the element itself.texttext is the string to be parsed as HTML or XML and inserted into the tree.<!-- beforebegin -->
<p>
<!-- afterbegin -->
foo
<!-- beforeend -->
</p>
<!-- afterend -->// <div id="one">one</div>
var d1 = document.getElementById('one');
d1.insertAdjacentHTML('afterend', '<div id="two">two</div>');
// At this point, the new structure is:
// <div id="one">one</div><div id="two">two</div>When inserting HTML into a page by using insertAdjacentHTML be careful not to use user input that hasn't been escaped.
It is not recommended you use insertAdjacentHTML when inserting plain text; instead, use the Node.textContent property or Element.insertAdjacentText() method. This doesn't interpret the passed content as HTML, but instead inserts it as raw text.
| Specification | Status | Comment |
|---|---|---|
| DOM Parsing and Serialization The definition of 'Element.insertAdjacentHTML()' in that specification. | Working Draft |
| 1 | 12 | 8 | 4 | 7 | 4 | 2.3 | 18 | 12 | 8 | Yes | 4 | Yes |
Element.insertAdjacentElement()Element.insertAdjacentText()XMLSerializer: Construct a DOM representation of XML text
var obj = { "flammable": "inflammable", "duh": "no duh"};$.each( obj, function( key, value ) { alert( key + ": " + value );});