--- fb_session.inc.orig	2009-09-24 18:04:48.000000000 +0200
+++ fb_session.inc	2009-11-04 14:07:51.187500000 +0100
@@ -83,6 +83,21 @@ if ($nid && isset($_REQUEST['fb_sig_api_
    $new_session_id = "fb_canvas_{$nid}_" . $sess_key;
    $new_session_name = "fb_canvas_{$nid}_" . $orig_session_name;   
  }
+elseif ($nid && isset($_COOKIE['fb_ahah_iframe'])) {
+  // For iframe canvas when we send AHAH content, the JS session uses a different session id than original form.
+  // In the case of an existing fb connect in the same browser, the js session use the same session id,
+  //  and we could take that session id from $_COOKIEs (as it is done later) but in the other case the used session 
+  //  is new and we need to read the session id from the local browser cookies. Added in FB Forms module.
+  $new_session_name = "fb_canvas_{$nid}_" . $orig_session_name;
+  $new_session_id = $_COOKIE['fb_ahah_iframe'];
+}
+elseif ($nid && isset($_REQUEST['fb_forms_iframe_session_id'])) {
+  // But for Safari there is no way to set cookies from different iframes.
+  // We use the same model than using fb_session_cookieless_iframe settings but passing the session_id in the form
+  // and not it the url as fb_sess, and only for safari browser not always
+  $new_session_name = "fb_canvas_{$nid}_" . $orig_session_name;
+  $new_session_id = $_REQUEST['fb_forms_iframe_session_id'];
+}
  else {
    // Try to learn session key from cookies (Facebook Connect)
    
