Ruby WebKit 2

The Ruby-WebKitGtk bindings are usable. Clone them:

git clone git://github.com/danlucraft/rbwebkitgtk.git

or download them. I’m using the WebKit nightly r31823, YMMV. Build instructions for WebKitGtk are here.

rbwebkitgtk.png

To do:

  • Finish the methods on WebView.
  • WebHistoryList
  • WebHistoryItem

9 Comments

Ruby WebKit : Nuclear-Powered NutcrackerApril 13th, 2008 at 9:34 am

[...] Update: These bindings are now pretty usable. See here. [...]

LuigiApril 18th, 2008 at 6:17 am

Hi, do you think is possible to use Ruby-WebKitGtk to embed Google Maps?
I’d like to get the coordinates from the position the user selects on the map.

http://grigio.org/xmp_manager

PhilippApril 23rd, 2008 at 10:24 am

Cool,
thanks that was i was looking for

PhilippApril 23rd, 2008 at 11:49 am

anyone a idea how do u get a swf to run with webkit ? possible to install adobe flash plugin ?

if i open a swf i see only some binary code ..

DanielApril 24th, 2008 at 3:26 am

Philipp: ultimately it should possible to do that since WebKit itself must have a way. I should ask at the WebKitGTK project since the Ruby bindings will probably not play a part in that.

Luigi: I’m not sure exactly what you mean. The WebKit bindings allow you to write a browser in Ruby, essentially.

If you embed Google Maps onto your own website you can direct the user of the Ruby/Webkit browser to that site, of course.

Alternatively if you direct the user to the official Google Maps site, you should still be able to get the information you need out of the browser by using the ‘execute_script’ to execute a bit of JavaScript that can figure out where the current location is. Not sure if Google Maps makes it easy for you though. :)

LucaJune 23rd, 2008 at 3:40 pm

Hi, I’m on Ubuntu hardy, I did:
export RG2_DIR=/usr/lib/ruby/1.8/gtk2/

But I get:

$ irb
irb(main):001:0> require ‘webkit’
LoadError: libwebkit-1.0.so.1: impossibile aprire il file oggetto condiviso: Nessun file o directory - /usr/local/lib/site_ruby/1.8/i486-linux/rbwebkitgtk.so
from /usr/local/lib/site_ruby/1.8/i486-linux/rbwebkitgtk.so
from /usr/local/lib/site_ruby/1.8/webkit.rb:7
from (irb):1:in `require’
from (irb):1
from :0

DanielJune 24th, 2008 at 8:51 am

Hmm, do you have webkitgtk installed from here live.gnome.org/WebKitGtk?

MariusNovember 17th, 2008 at 6:29 am

Hi,
this is great, thanks very much for the effort!

I’m just having a hard time digging deeper because i can’t find a usable reference text or api docs or something.
Is there such thing available?

For instance, i wonder
- how to access the ‘page’ or ‘frame’ object of a WebView
(they are passed in some signal handlers, but can they be fetched from the WebView object?)
- how to handle something like ctrl+click or middle-click to open page in new window/tab
(signal navigation_requested might be a way, but it always breaks)

Ondrej BilkaNovember 20th, 2008 at 1:17 am

Makefile and etxconf.rb should be updated.
change name to webkit-1.0 and include path to webkit-1.0/webkit

Leave a comment

Your comment