{"action":"created","issue":{"url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/14","labels_url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/14/comments","events_url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/14/events","html_url":"https://github.com/brcontainer/html2canvas-php-proxy/issues/14","id":71232659,"number":14,"title":"Not getting data back but the path to the files (html2canvas 4.1)","user":{"login":"slopespotter","id":12134164,"avatar_url":"https://avatars.githubusercontent.com/u/12134164?v=3","gravatar_id":"","url":"https://api.github.com/users/slopespotter","html_url":"https://github.com/slopespotter","followers_url":"https://api.github.com/users/slopespotter/followers","following_url":"https://api.github.com/users/slopespotter/following{/other_user}","gists_url":"https://api.github.com/users/slopespotter/gists{/gist_id}","starred_url":"https://api.github.com/users/slopespotter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slopespotter/subscriptions","organizations_url":"https://api.github.com/users/slopespotter/orgs","repos_url":"https://api.github.com/users/slopespotter/repos","events_url":"https://api.github.com/users/slopespotter/events{/privacy}","received_events_url":"https://api.github.com/users/slopespotter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-27T09:33:47Z","updated_at":"2015-04-27T15:57:59Z","closed_at":null,"body":"Hello Guilherme,\r\nI am trying your proxy with the CDN 4.1 version of html2canvas to fetch a whole site with images. The file fetching (html and images) works fine, everything is saved in the /images folder. However, upon returning to the script instead of getting the HTML and base64 encoded images, I receive the PATHs to the temp files. Thus the following standard implementation of html2canvas doesn't seem to work:\r\n\r\nfunction startCapture2() {\r\n  var url = \"http://google.com\";\r\n  var urlParts = document.createElement('a');\r\n  urlParts.href = url;  \r\n  alert(urlParts.href); \r\n  \r\n  $.getJSON(\"html2canvasproxy.php?callback=?\", { xhr2:false, url:urlParts.href }, function(html) {\r\n      alert(html);\r\n      // NO HTML COMING BACK HERE BUT THE PATH http://localhost.......html\r\n\r\n      iframe = document.createElement('iframe');\r\n      $(iframe).css({ 'visibility':'hidden'}).width($(window).width()).height($(window).height());\r\n      $('#content').append(iframe);\r\n      d = iframe.contentWindow.document;\r\n      d.open();\r\n      $(iframe.contentWindow).load(iframeLoad.bind(null, iframe));\r\n      $('base').attr('href',urlParts.protocol+\"//\"+urlParts.hostname+\"/\" + urlParts.pathname);\r\n      html = html.replace(\"<head>\",\"<head><base href='\"+urlParts.protocol+\"//\"+urlParts.hostname+\"/\" + urlParts.pathname + \"'  />\");\r\n      if($(\"#disablejs\").prop('checked')){\r\n        html = html.replace(/\\<script/gi,\"<!--<script\");\r\n        html = html.replace(/\\<\\/script\\>/gi,\"<\\/script>-->\");\r\n      }\r\n      d.write(html);\r\n      d.close();\r\n  });\r\n}\r\n\r\nWhat am I missing here?\r\nThanks"},"comment":{"url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/comments/96722523","html_url":"https://github.com/brcontainer/html2canvas-php-proxy/issues/14#issuecomment-96722523","issue_url":"https://api.github.com/repos/brcontainer/html2canvas-php-proxy/issues/14","id":96722523,"user":{"login":"brcontainer","id":4368952,"avatar_url":"https://avatars.githubusercontent.com/u/4368952?v=3","gravatar_id":"","url":"https://api.github.com/users/brcontainer","html_url":"https://github.com/brcontainer","followers_url":"https://api.github.com/users/brcontainer/followers","following_url":"https://api.github.com/users/brcontainer/following{/other_user}","gists_url":"https://api.github.com/users/brcontainer/gists{/gist_id}","starred_url":"https://api.github.com/users/brcontainer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brcontainer/subscriptions","organizations_url":"https://api.github.com/users/brcontainer/orgs","repos_url":"https://api.github.com/users/brcontainer/repos","events_url":"https://api.github.com/users/brcontainer/events{/privacy}","received_events_url":"https://api.github.com/users/brcontainer/received_events","type":"User","site_admin":false},"created_at":"2015-04-27T15:57:59Z","updated_at":"2015-04-27T15:57:59Z","body":"html2canvas-php-proxy requires a \"callback\" valid (`?` is invalid) and this lib don't return json data, try this:\r\n\r\n```\r\nfunction createFrame(html) {\r\n    console.log(\"createFrame:\", html);\r\n\r\n    var iframe = document.createElement('iframe');\r\n    $(iframe).css({ 'visibility':'hidden'}).width($(window).width()).height($(window).height());\r\n    $('#content').append(iframe);\r\n\r\n    var d = iframe.contentWindow.document;\r\n    d.open();\r\n\r\n    $(iframe.contentWindow).load(iframeLoad.bind(null, iframe));\r\n\r\n    $('base').attr('href', urlParts.protocol+\"//\"+urlParts.hostname+\"/\" + urlParts.pathname);\r\n    html = html.replace(\"<head>\", \"<head><base href='\"+urlParts.protocol+\"//\"+urlParts.hostname + \"/\" + urlParts.pathname + \"'  />\");\r\n\r\n    if($(\"#disablejs\").prop('checked')){\r\n        html = html.replace(/\\<script/gi,\"<!--<script\");\r\n        html = html.replace(/\\<\\/script\\>/gi,\"<\\/script>-->\");\r\n    }\r\n\r\n    d.write(html);\r\n    d.close();\r\n}\r\n\r\nfunction startCapture2() {\r\n    var url = \"http://google.com\";\r\n    var urlParts = document.createElement('a');\r\n    urlParts.href = url;\r\n\r\n    console.log(\"URL:\", urlParts.href);\r\n\r\n    $.ajax(\"example.php\", {\r\n        \"data\": {\r\n            \"url\": urlParts.href,\r\n            \"callback\": \"createFrame\"\r\n        }\r\n    }).done(function(response) {\r\n        if (response.indexOf(\"createFrame(\") === 0) {\r\n            window.setTimeout(response, 1);\r\n        } else {\r\n            console.log(\"error:\", response);\r\n        }\r\n    }).fail(function(err) {\r\n        console.log(\"error:\", err);\r\n    });\r\n}\r\n```"}}