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!
Showing posts with label facebook application. Show all posts
Showing posts with label facebook application. Show all posts
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:
Subscribe to:
Posts (Atom)