Bootstrapping Prototype to allow simple widgets?

Hi.

I am trying to create a simple widget that people can add to their
site with one script tag, like the following:

The action is an RJS that renders some HTML at that spot (like a
widget):

page.insert_html :top, :widget_div, :partial => ‘widget_partial’

The issue is that the regular Prototype libraries are not included
yet, so there is an error when it tries to get ‘element’.

If I include the Prototype libraries in one of my own test pages it
works the way it should, but I can’t depend on someone adding those
libraries and want to try to make it as ‘drop in’ as possible.

Any thoughts on how I can ‘bootstrap’ Prototype in this type of
scenario? Does anyone have tips on how to achieve something like this
in another way?

Thanks in advance for any help.

On Nov 6, 2:01 am, chrizbot [email protected] wrote:

page.insert_html :top, :widget_div, :partial => ‘widget_partial’

Well a simple solution would be for the output of your action to
include prototype. Why not just tell people that they have to add 2
script tags, one for prototype, one for your thing? (people don’t need
to install anything, google hosts copies of prototype that anyone can
link to). One think to consider is that including prototype might
break some people’s websites (if they use a js library that conflicts
with prototype).

Fred