Search code examples
javascriptfacebookcanvasfacebook-c#-sdkfacebook-iframe

Full page reload of a Facebook app with IE, but not with Chrome


I've developed a Facebook application using the Facebook C# SDK. Interestingly, whenever the user clicks on a link in Internet Explorer, the whole page reloads - including the friends list on the right and the chat list. If one does the same with Chrome, this doesn't happen - only the canvas page gets reloaded, but the lists on the right remain untouched.

I traced the problem using the Fiddler Web Debugger and found the following. Assume my application is called my_app, and it is deployed on Windows Azure (cloudapp.net). Thus, a click on a link (to the same page, for instance) in IE results in the following calls:

  1. my_app.cloudapp.net/Default.aspx
  2. www.facebook.com/dialog/oauth/...
  3. www.facebook.com/dialog/permissions/...
  4. cloudapp/facebookredirect.axd?state=...
  5. apps.facebook.com/my_app/...
  6. my_app.cloudapp.net/Default.aspx

The backtrace from Chrome is completely different:

  1. my_app.cloudapp.net/Default.aspx
  2. www.facebook.com/extern/login_status.php?...

For some reason the authorization process from Chrome is different. I implement the authorization as it is done in the sample files from the Facebook C# SDK - using CanvasAuthorizer.Authorize(). Any ideas why this problem occurs and do you have any recommendations on how to get the Chrome behavior on IE?

Many Thanks, Yordan


Solution

  • I would bet it's a cookie issue. IE can act odd with cookies in iFrames (which is likely why its reauthenticating with every request).

    I don't know about that SDK, but try adding something like this to your code behind master page - this is a P3P privacy policy that might help.

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