Embedding Javascript in Google Sites Wiki

Yesterday, I almost pulled my hair out (only the silver ones, though) trying to embed social bookmarking service, Diigo-generated javascript to reflect my favorite links. In fact, I failed miserably. Why isn't embedding Javascript on GoogleSites as easy as Wikispaces?

Of course, a quick Google search revealed a workaround and a learning opportunity. Though I don't know who AHSDiigo (ok, it looks like it's Karl Fisch!) is, I was thrilled they'd prepared a nice tutorial on how to get the job done!

Here's what s/he wrote:

Google Sites does not allow you to embed javascript directly (many web pages, including AHS web pages do, so this is only a problem if you're using Google Sites). Instead, you need to use a Google Gadget. There are thousands of gadgets available so, for example, I used the RSS Reader + gadget to embed the RSS feed above. But the three Diigo Group embeds all use javascript and I was unsuccessful finding a Google Gadget that allowed me to put my own javascript code in (it probably exists, I just couldn't find it). It turns out that it's pretty easy to create your own gadget, as long as you have someplace on the web to host it and then point to it from your Google Site.
To create your own gadget, you need to create a text file. Within that text file, you need the following code:
 
Put your javascript code here
]]> 
You simply copy the embed code from the Diigo group widget, paste it into the spot where it says "Put your javascript code here", then save the file as a text file with .xml on the end. Then you have to put that file somewhere on the web that you have access to (you can actually upload it as an attachment to your Google Site, then use the URL for that attachment). Once you've done that, add a gadget to your Google Site (Insert -->more gadgets), then choose Add Gadget by URL and type in the URL where your gadget resides.

It's a pretty nifty trick! Karl even provided a download! Thanks so much!!



Subscribe to Around the Corner-MGuhlin.org



Everything posted on Miguel Guhlin's blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure

Comments

Unknown said…
I'm getting the following error when attempting to follow these instructions

The gadget you added is not valid

Unsupported feature: org.apache.shindig.common.xml.XmlException: The system identifier must begin with either a single or double quote character. At: (1,63)

Any ideas?
Unknown said…
A little more searching and I found my mistake. I tried to upload the xml file to Google docs. Instead upload to a page on your site. You can create a new file cabinet page on your google site by going to New Page, and selecting File Cabinet as the template.

Thanks for the wiki :)
Miguel Guhlin said…
@Unknown, great, thanks for sharing your solution to the problem!
Scott Slocum said…
This method worked to put the GoDaddy domain-certification seal on a page of my Google Site.

Popular posts from this blog

#Chromecast Add-Ons to Play Various Video File Formats

Free Professional Learning! Education On Air #googleedu

10 Steps to a Blended Learning Classroom #MIEexpert #MIE #tceamie1