Monday, August 22, 2011

AJAX Call Problem in Facebook application http / https issue

Today I got report from one of my client (for whom I have developed a facebook app recently) that in some browsers the app is not working. Nothing happens when a button is clicked (a facebook share dialog should appear)! So, I investigated the problem. I found that when the button is clicked, the URL used for AJAX call starts with https and in some browsers (example: Chrome) it was giving a javascript error. This is because the application started with http there where in some other facebook account, it start with https. So I handled the issue with the following code in my jQuery function that is called when the button is clicked:
 var protocol = $(location).attr("protocol");  
 var loadUrl = 'http://secure.example.com/server/serve.php';  
 if (protocol == 'https:') {  
     loadUrl = 'https://secure.example.com/server/serve.php';  
 }  
And it solved the problem!

Thursday, July 28, 2011

I am back

It's been a while I am not writing in this blog. But I frequently get into problems and find solutions searching Google, so I think I should write down my problems and solutions, at least the link. Sometimes I also read interesting blog posts about programming or software development or something else that is not worth sharing in facebook, so I shall share those links also with my comments.

Stay tuned. :)