Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 520

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 535

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 542

Deprecated: Assigning the return value of new by reference is deprecated in /home/gathadam/public_html/wp-settings.php on line 578

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/gathadam/public_html/wp-settings.php on line 18
2007 June

How to set third-party cookies with iframe Facebook Applications

So you’ve written your facebook application, and you’ve gone the quick’n'easy route by making it an iframe application. The world is your oyster and any day now you’ll have your millionth user. Until you try to write a cookie.

Cookies written by your application will be treated as Third Party cookies by your browser, and in IE6 with the default privacy setting of ‘Medium’, they will be deleted. This can lead to all sorts of problems, from user settings not being remembered to total app breakdown (which, funnily enough, is what happened to me).

As it turns out, there is a simple solution. If you supply a ‘compact privacy policy’ with your page, then IE will treat the cookies with respect and let them through.

To the code

Just add this to the start of your page (every page where cookies will be written):


HttpContext.Current.Response.AddHeader("p3p", "CP=\""IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""")




How to write a FaceBook Application in 10 minutes

Writing F8 apps is where it’s at right now. Everybody knows it. The userbase is huge and now we have a (free) API to. Everything is good….but the documentation.

I spent a day writing my Sudoku Facebook application yesterday. I already had the sudoku javascript widget ready to go - the time was spent wading through pages of documentation and downloading toolkits that (as it turns out) I didn’t need.

As far as I can tell, Facebook allows you to create applications that appear to the user in 2 different areas.

1 - The profile. This the ‘main user page’ as far as Facebook is concerned. Here is where your main summary details are displayed and your comments wall. It would be great to have your widget displayed here, but the big limitation is that applications that use javascript are not allowed here (You must use FMBL, the facebook version of HTML). Too bad for me. What we can do is display a small ad to take the user to the Canvas page.

2 - The ‘Canvas page’. This is an entire page that your application gets to use (you can have multiple pages if you want). On these pages you can choose to display content from another website through an iframe, so that is what we’re going to do.

Ok, thats it for the overview. Start your clocks and lets get cracking.

1. Create your demo page. (2 minutes)
This is the page that the user will see on their canvas page. If you already have a page that you want to use, great. If not, then just copy this code for a guessing game.

<script type=text/javascript>
var iRandom;
function Restart()
iRandom = Math.floor(Math.random()*10)+1;
alert('OK, I am thinking of a number between 1 and 10');
function Guess()
var yourGuess = document.getElementById('myGuess').value;
if (yourGuess>iRandom)
	alert('Too High.');
if (yourGuess<iRandom)
	alert('Too Low.');
if (yourGuess==iRandom)
	alert('Well done! You guessed it.');
<div>Enter your guess between 1 and 10: <input type=text id='myGuess' name='myGuess'>
<input type='button' onClick='Guess()' value='Guess'>
<input type='button' onClick='Restart()' value='Start Again'>
<script type=text/javascript>

It’s not going to win any awards, but it gets the job done. Save the file somewhere on your website as ‘guess.htm’. Mine is saved at

Ok, now log into Facebook.

2. Install the Developer Application. (1 minute)
This allows you to create applications.

3. Create the Application. (30 seconds)
Click the ‘create application’ link
4. Fill in the Application details. (6 minutes)
There are heaps of fields you can enter, I am just going over the ones you need to get this demo working.

Application Name: Any name you want. I used ‘Guessing Game’.
Terms of Service checkbox: Check it.
Click ‘Optional Fields’.
Callback Url: This should be the root directory that your ‘guess.htm’ page is found at. You must also add a ‘/’ at the end. I used ‘’.
Canvas Page URL: This is the most confusing part, and wasted me heaps of time. What they want you to enter is basically a directory name for your applcaition. The name must be 7 characters or more, and must be unique from other Facebook applications. I used ‘guessab’ (so you can’t). When you add ‘’ to the front you have the Canvas page URL.
NOTE: If you use upper case in the Canvas Page URL, it will be converted to lower case automatically. Also, case is important, so if you use upper case in your links later on THEY WON’T WORK.
Tick ‘Use iframe’: This means that your canvas pages will use an iframe.
Application Type: Leave it at ‘website’.
Can your application be added on Facebook?: Tick ‘Yes’.
Application Description: I used ‘Cool guessing game’. If you disagree, feel free to use your own description.
Default FMBL: We will fill this out last, so leave it for the moment.
Default Profile Box Column: Tick ‘Narrow’.
Side Nav URL:OK, here is where we put a link in the side nav to the canvas page.
The full canvas page has the format:< value entered in Canvas Page URL>/
So for me, the full canvas page URL is:
Facebook maps ‘’ to your Callback URL, so what is loaded in the iframe is:
Note: Notice there is no ‘/’ inserted in guess.htm, that is why you have to put it in your Callback URL.

Anyway, now we can go back to
Default FMBL: This is the text that will go on the user’s profile. Lets just put another link to our game on the Canvas page. I entered:

Lets play a <a href=’’>Guessing Game</a>

5. Add the application (30 seconds)
From within ‘My Applications’, click on ‘View About Page’ for your new application. Then click ‘Add Application’, and confirm this.

6. Done! (Lets play)

Click on the link in either the left nav panel or the main profile panel and knock yourself out.

Test my Facebook Application :)

I’ve developed my first Facebook application (Facebook is a US college social network) and was hoping there are some people who could test it for me.

If you are a member of facebook, just enter:

Then click ‘Add this application’ at the top right of the page.

Any feedback is much appreciated.


Celebrities Widget

The sort of work that I do on the internet is extremely serious, and this is more of the same.

A Celebrity Widget! Yep, now you can get up to the moment pics of the most popular celebs (male or female) zapped straight onto your site or blog.

Now that was a fun use of my time ;). Of course, you can get your own Celebrity Widget.

Automatically make an ‘Add to Blogger’ button for your Widgets

Since creating the Sudoku Google Gadget I’ve been going crazy building all kinds of widgets (so craaazy, that I have neglected this blog). One of the biggest hurdles getting the widgets ‘out there’ is that plenty of blog owners have no idea how to add the widget code to their blog. So lets make it easy for them. Lets just give them a ‘Add to Blogger’ button.

Blogger/Blogspot have actually done the hard work already, allowing widgets to be added by using either a GET or POST to a specific URL (More Details). All we have to do is come up with the correct form of the querystring and then wrap a button around it.

So that’s what I did.

Just enter the name and code for your widget in the top text boxes, press the Create button, and you get the code to add to your website. The code renders as a button, and we’re done. Easy!

To test it out, I took this HTML:

Get on down to <a href=''></a>

with the widget name ‘Test Widget’. Pressed the create button, and came up with:

<script type='text/javascript'> function AddToBlogger() { var sCode="undefined";self.location.href='' + sCode ;} </script> <input type='button' value='Add Test Widget to my blog' onClick='AddToBlogger()'>

And here is what it looks like: