{"id":5597,"date":"2014-04-03T08:18:24","date_gmt":"2014-04-03T08:18:24","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/03\/canvas-getimagedata-not-working-on-mobile-safari-collection-of-common-programming-errors\/"},"modified":"2014-04-03T08:18:24","modified_gmt":"2014-04-03T08:18:24","slug":"canvas-getimagedata-not-working-on-mobile-safari-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/03\/canvas-getimagedata-not-working-on-mobile-safari-collection-of-common-programming-errors\/","title":{"rendered":"Canvas getImageData not working on Mobile Safari-Collection of common programming errors"},"content":{"rendered":"<p>I am trying to extract the pixels from a canvas on mobile safari (iOS 5.0) but I am getting a strange TypeError:<\/p>\n<pre><code>&gt; var ctx = canvas.getContext(\"2d\");\n&gt; ctx.getImageData(0,0,canvas.width,canvas.height);\n\n&gt; ImageDataConstructor\n    constructor: Object\n    data: TypeError: 'undefined' is not an object\n    height: 50\n    width: 50\n    __proto__: Object\n<\/code><\/pre>\n<p>Somehow this extremely trivial piece of code is not working on mobile safari (testing with Weinre) but it does run on desktop safari and chrome&#8230;. Can anyone help me? Why is the data object reporting a TypeError??<\/p>\n<p>Thanks,<\/p>\n<p>Rob<\/p>\n<p>PS. I tried with an empty canvas, and one with actual content in it<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I am trying to extract the pixels from a canvas on mobile safari (iOS 5.0) but I am getting a strange TypeError: &gt; var ctx = canvas.getContext(&#8220;2d&#8221;); &gt; ctx.getImageData(0,0,canvas.width,canvas.height); &gt; ImageDataConstructor constructor: Object data: TypeError: &#8216;undefined&#8217; is not an object height: 50 width: 50 __proto__: Object Somehow this extremely trivial piece of code is not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5597","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5597"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5597\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}