Put Javascript into Google Sites


Share the love!

javascript_logo addition sign Logo-Google-Sites-sm Equal Sign heart

 

 

If you have spent anytime working in Google Sites you may have found a roadblock when it comes to embedding javascript into Google Sites.  The specific tag that Google Sites does not like is <script> </script>. Luckily for us, Miguel Guhlin and Karl Fisch have written about a workaround.  Their posts are specific to Diigo, but I am happy to report that this will work for any site that has an embedable object that use the <script> </script> code.  My purpose was to embed the Twitter profile widget into my site www.mikeagostinelli.com  I also ran into this problem when trying to embed my Onepage card in my Google Site.

Here is the fix:

You need to create a Google Gadget file that you can access from a server.  I used my public Dropbox as my place to share the file.  To create the Google Gadget you need to use a text editor (Like notepad on Windows or Textedit on a Mac) and write the following code:

<Module>
<ModulePrefs title=”Custom Gadget“/>
<Content type=”html“>
<![CDATA[
<script src=YOUR SCRIPT HERE</script>
]]>
</Content>
</Module>
Then save the file as Name.xml and upload it to a file hosting service that has public access (not password protected) – Like Dropbox and copy the public link to the file:
insert_google_sites
google_sites_gadget_share
google_sites_url_for_gadget
Once you copy your url to the saved .xml Google Gadget code, you will have javascript embedded through your very own custom Google Gadget.

And that is what we like to call:  Gettin’ your Nerd on :)
If you would like to see a finished gadget to work from, here is a like to my custom twitter Google Gadget:
And finally if you want to see the custom twitter Google Gadget live on my site:

 

Comments

comments

Categories

+ There are no comments

Add yours