Integrating Javascript widgets with Drupal

I found this nifty little Jscript widget that I want to integrate with my site. I want to be able to place it where I want to of course. There is the widgets module that I used to integrated the Bing translation bar. But I had a little trouble with that and I am not sure why. So I decided to follow the KISS rule and Keep It Simple Stupid….

The widget is a small snippet of HTML that calls a .js file. So, I loaded the .js file into the sites/all/libraries folder in a folder called find and then changed the path to the js file in the HTML snippet. I then took the HMTL snippet and put it into the body of a content type that I created that allows Full HTML as its text type. Now, I am able to place that node of content in any panel page that I might need it. None of this is Drupal specific per se, so this will work with any jscript widget.

  • Place the HTML in the body of a node that allows full HTML – I use CKEditor to edit nodes so when I go to place the HTML, I make sure to click the “source” button. 
  • Change the HTML reference to the js file in the html so that it is correct
  • Upload the js file into the libraries folder, creating a directory structure that is consistent with any other libraries that you have uploaded.
  • Use Panels to add the node with the HTML anywhere that you might need it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: