WebKit plugin example using MacRuby
A WebKit plug-in implemented in MacRuby. The plug-in’s view is a NSTextField subclass, text entered in the textfield is eval'ed as Ruby code. The sample also illustrates how to use the WebView's UIDelegate to call back to the application.
The custom view from the plugin is loaded in test.html with the following tag:
The MIME-type is defined by the plugin itself, see the plugin’s
The plug-in in action: http://cl.ly/3D3V2Q430V0r0M0B062z
Purpose of this example
The main purpose of this example is to show how to use custom NSView classes in a WebView in a MacRuby application that uses a WebView for its interface.
Theoretically these plugins can be used with any WebKit based application, but only if they support garbage collection.
TL;DR, so how do I use it in [insert favorite browser]?!
Whoa, hold your horses, son. Because this brings us to the most important note, and will most probably be sad news to you, which is that none of the common WebKit based browsers support this... This means no Safari nor Chrome.
The latter could possibly be compiled with garbage collection support, it’s completely open-source after all, but I was not able to do so in my quick attempts.
In case you'd like to have a go, I could not get ‘Chromium Framework.framework’ to support it. Let me know if you are successful.
So there’s no way to play with this in a web browser?
Sure there is. In this repo you will find, next to the WebViewBasedApp example, a simple web browser by MOApp. Select this ‘executable’ to install the plugin in the browser instead of WebViewBasedApp.
Alternatively you can install the plugin in one of these following locations:
- ~/Library/Internet Plug-Ins
- /Library/Internet Plug-Ins