How to put a calendar on your personal web site ?

Continuing from before, I want to mention more powerful ways of embedding Google calendar on your website. The technique I mentioned in my previous post has a limitation in that you have to make your calendar public to be able to share it on your blog. Now that is a serious limitation if you want your calendar to be private. To solve the problem, there is Google Calendar API

If you are not familiar with Google APIs, watch this video

You can use Google Calendar API from your website by using their Javascript client library (without requiring you to write any server side code or proxies to access their web service). They also work around the same origin policy of the web browser, so you wont run into cross domain issues. To use their API, you need to follow these steps:

1.  Obtain a developer key

You have to obtain a separate key from google for each website you are planning to use Google’s APIs on. All you have to do is enter your website URL in this form:

image

2. Embed script in the <head> section of your HTML markup

image

This will fetch the Google API loader

3. Load the client library by calling google.load(”gdata”, 1). This will load the GData client library.

Make this call in the head section of your HTML document too.

4. Now set a callback to have google API call your code after the library has been completely loaded

google.setOnLoadCallback(yourmethodname)

Now you have finished initializing the API

Details about how to use this API to

1. Read your public calendars

2. Read your private/shared calendars by authenticating

3. Post/update your calendar items

are available very clearly at this site: http://code.google.com/apis/calendar/developers_guide_js.html#Obtain_Key

Interesting read.

Now for those who do not want to go through all this trouble without first seeing it in action, I recommend, you follow these examples and study their source code. Click on this image to go to the samples page

image

You can now create powerful applications using Google Calendar API.

Also, if you need information on how to use Google Authentication on your homepage (instead of Windows Live ID authentication we talked about in an earlier post), visit this page

http://code.google.com/apis/gdata/auth.html

This is useful if you are using Google services and want to build kool applications using their GData API and embed them on your page.

Leave a Reply