Better HN
topnewbestaskshowjobs
Log inSign up

niklasvh

32 karma · joined Jul 27, 2011 (15y ago) · 12 submissions

Submissions

comment 14y ago · link · parent

I had that very same idea, but personally think it would be far harder to do a JavaScript VM written in pure PHP than it is to do it this way around.

comment 14y ago · link · parent

It has no real practical use, but it was an amazing learning experience for me. So many puzzles to solve

comment 14y ago · link · parent

There is no physics implemented on the z-axis yet.

comment 14y ago · link · parent

You can't

comment 14y ago · link · parent

The loading time could be significantly lowered if the files would be converted into a more accessible format for JavaScript. Especially the sprites/textures, if they would pre-processed into PNG's or something more understandable by javascript, the loading time could already be dropped by a second or two.

comment 14y ago · link · parent

What kind of graphics card you got?

comment 14y ago · link · parent

There are 3 cars, none of them stealable though :(

comment 14y ago · link · parent

There is no additional code in the script which is there to just support FF down to 3.6, the reason the script isn't supported on older FF versions is due to lack of key methods missing/or partial support (i.e. getBoundingClientRect, canvas etc.). Nor is there any functionality in the script that the support for FF 3.6 is holding back.

comment 15y ago · link · parent

copy of the proxy source available at https://github.com/niklasvh/html2canvas-proxy now

comment 15y ago · link · parent

I'll put python/java/php sources up once I got the specs for the proxy more set (currently still could get some changes that could break the whole functionality), but in short it provides the images either base64 encoded jsonp if browser doesn't support XHR2, if it does, it provides it as an image with CORS enabled (prefered as it is slightly smaller than base64 encoded).

For the HTML, it just checks a simple charset check and does the same as for images.

There are plenty of examples of the script embedded on the page though, and you can always download a copy from github and try it on your own page meanwhile.

comment 15y ago · link · parent

Yep, didn't think the proxy would be getting +100k requests within 24 hours. Guess we need to wait for tomorrow :(

comment 15y ago · link · parent

Looking at the supported browsers on http://www.google.com/tools/feedback/intl/en/index.html and some of the clearer bugs in their screenshots (enlarge the picture, check out for example text-underlining and compare with FF/Chrome), combined with what ElliottZ mentioned in this Twitter message https://twitter.com/#!/ElliottZ/status/89520809147772929, I could with quite high certainty say that they have a very similar approach to doing this. Having worked with this for some time already, I can see why they for example have not supported Opera, although the problem (presumably the reason they don't) can easily be fixed with wrapping text in temporary nodes for example. One major advantage they have, which works for their favor is that they use the script on pages they control, where as my approach is trying to get this working on any page, regardless of who created it with as bad CSS/HTML as they did. If you aren't gonna be using z-index positioning, no letter-spacing, no CSS3 properties, no HTML5 form elements etc. it can be very easy to make matching screenshot to the page.

For IE<9 the Flash option won't have to be the only option either, a server could be rendering the elements gathered from the users browser (in other words a canvas proxy for the canvas renderer).

In terms of my script, the aim is to try and get the compatibility down to FF3, IE6 (with non-canvas support through flashcanvas or server canvas), Opera (haven't looked much yet how old version would be able to support it), and Chrome.