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


Discover more from Another Think Coming

Subscribe to get the latest posts sent to your email.

8 comments

  1. I'm getting the following error when attempting to follow these instructions The gadget you added is not validUnsupported 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?

  2. I'm getting the following error when attempting to follow these instructions The gadget you added is not validUnsupported 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?

  3. 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 🙂

  4. 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 🙂

Leave a reply to Miguel Guhlin Cancel reply