top | item 7921699

Webkit.js

205 points| ndesaulniers | 11 years ago |trevorlinton.github.io | reply

103 comments

order
[+] dag11|11 years ago|reply
I thought it was a static rendering, but then I put in a marquee tag and it moved flawlessly across the screen.

Impressive. I can't say I see the practical implementations of this, but I'm sure there's some. But it's impressive nonetheless.

[+] pfraze|11 years ago|reply
Rendering HTML to WebGL textures would be big, which I think this could do - though probably not as performantly as the browser could. It's currently not possible, partially due to security concerns if I remember right.
[+] bastawhiz|11 years ago|reply
At some point, it won't matter whether your browser supports a particular feature of the web. Any site could just embed a copy of WebKit for browsers that are too old (i.e.: when the latest version of Firefox is a few dozen versions behind) and render the page using the latest rendering engine.
[+] jstsch|11 years ago|reply
Neat. Getting some good use out of HTML2Canvas as well. But always wondering why there is no way to get a bitmap from screen... something like window.getPixels(x, y, width, height).
[+] theallan|11 years ago|reply
Yes! This would open a huge number of possibilities. Simple things like a colour picker, to transitions based on the content of the window would be made possible. I would love to see this happen.
[+] heydenberk|11 years ago|reply
It's a little contrived, but a "practical" use of this might be for an online HTML editor to embed the document (or display a preview) without any interference from the parent document.
[+] schrodinger|11 years ago|reply
You can do that via iframe as well
[+] PLenz|11 years ago|reply
Anyway to get this to run in node with the output going to say Cairo? It'd be a fun little project to see if you could build a simple but working browser in nothing but JS.
[+] msvan|11 years ago|reply
And then, getting the browser running itself in the in-browser browser.
[+] tlinton|11 years ago|reply
Yes, there's a software rendering version, it actually uses Cairo. Software rendering just bitblts up (out of a webworker or as a SDL_UpdateRect) callback in javascript as a RGBA array.
[+] i_am_ralpht|11 years ago|reply
In Chrome (for me, on 64bit Linux) it consumes 176MB of RAM -- for all of WebKit + Cairo + FreeType/HarfBuzz/etc -- it's most of an OS right there.

GMail, a webapp email reader, is currently taking 368MB of RAM. Insane!

[+] reubenmorais|11 years ago|reply
"Web browsers have never been more memory efficient, and web pages have never had more memory bloat." - someone on Twitter a couple days ago
[+] grimtrigger|11 years ago|reply
Pretty cool. There's been a push to make HTML run everywhere, but this proves you can make X run on HTML.

Maybe someday we'll code apps in Objective-C/Java that run in the browser, all inside a canvas.

[+] emilsedgh|11 years ago|reply
That would be a sad day. Layers upon layers of complexity, abstraction, technologies, etc.

Please make it easier. More simple.

[+] ozten|11 years ago|reply
FirefoxOS will host Safari / Chrome apps, before iOS will allow a Firefox.

Open FTW.

[+] atonse|11 years ago|reply
What exactly are iOS users missing in Safari, in your opinion, that they would get from Firefox? I can see that Chrome has some cool sync features if you're into that sort of thing. But it still uses WebKit. And from what I've observed, people seem happy with the "Chrome" app in the app store, even though it uses a handicapped renderer. (Although in iOS 8, it won't be handicapped anymore, and will be as powerful as native Safari)

(Also WebGL support is new in iOS). Are people really clamoring for the Firefox engine to be supported in iOS?

[+] LukeB_UK|11 years ago|reply
Getting errors on chrome 35.0.1916.153 on Linux Mint.

56 on line 34 in webkit.api.js

Uncaught #<error> on line 15633 in webkit.bin.js

[+] tlinton|11 years ago|reply
If you put in any HTML that requires webkit to go out to hte network it crashes since network requests are disabled in the demo.
[+] Yoric|11 years ago|reply
Nice one. Next step is porting $YourFavoriteWebkitBrowser to Firefox OS :)
[+] Rinum|11 years ago|reply
Very nice and with JS support it would be perfect! I wonder if this is a solution to potential XSS attacks with embeded iframes or embeded user-generated html+css+js.
[+] m1sta_|11 years ago|reply
I'm quite interested in seeing this evolve, but for your purposes will postMessage not do?
[+] dingdingdang|11 years ago|reply
Why? Not being dry/evil, simply just interesting in whether this project has practical offshoot or is pure fun (..)?
[+] gol706|11 years ago|reply
Doing this in the browser might be a little silly, or at least I can't immediately think of a good use, but I think using this in a node.js program as an easy way to template something out and render an image/pdf locally could be useful.
[+] bluetidepro|11 years ago|reply
I was wondering the same thing. Why would anyone ever need to do something like this? What kind of project would this come useful?
[+] atomical|11 years ago|reply
I've been watching this project hoping that eventually PDFs could be rendered on the client.
[+] tlinton|11 years ago|reply
Is this a big needed feature? It's actually really easy to pull of, cairo's backend can be switched from using images to svg, to pdf's. It's just switching the backend and once the renderer is done just spit out the results.

Add it as a feature request on github and i'll add it to the api.

[+] atomical|11 years ago|reply
Sorry, I meant rendered from javascript templates in the browser.
[+] mantraxC|11 years ago|reply
I remember when for some reason people started writing SVG and HTML engines for Flash. Because, I don't know. They wanted to put a browser in your browser, so you can browse while you browse.

The engines worked, but where are they now? Nowhere. Just like Flash.

No matter how much effort you put into something, no matter how functional it is, now matter how much geek cred you'll get for it, if it doesn't have some sensible use, at least superficially, it'll linger and die. Wasted effort.

Just because you can do something...

[+] notastartup|11 years ago|reply
this is pretty cool but network requests and javascript support would make it even more crazier.

I viewed the html source for this page and pasted it. I was quite impressed. It looks like this is supposed to be a browser engine written in Javascript?

So essentially we would have a sandbox browser within a browser? That would be awesome.

[+] ndesaulniers|11 years ago|reply
> javascript support would make it even more crazier

There's interesting research being done in the area of meta-circular interpreters. There's techniques for speeding them up; they're not as slow as I'd expect. For example, one interpreter can do type analysis and rewrite chunks of code.

[+] userbinator|11 years ago|reply
this is pretty cool but network requests and javascript support would make it even more crazier.

The first thought that comes to mind would be to try to nest the things... a browser inside a browser inside a browser.