If I try and load my canvas app using Safari on PC/Mac or iPhone it infinitely reloads with third party cookies disabled. I know this is not a new issue....
However, I can load the Drupal for Facebook canvas app without any issues. I have tried turning on everything under Settings > Sessions and Settings > Javascript, but it does not help. I have also tried the latest dev build.
What am I doing differently that causes this infinite reload?
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | fb_safari_redirect.diff | 1.63 KB | Dave Cohen |
Comments
Comment #1
notluap commentedStill having this issue... anyone have a workaround to get Safari working with third party cookies disabled?
Comment #2
Dave Cohen commentedI've tried a few experimental things to get around third-party cookie issues over the years. I think the difference may be that drupalforfacebook.org has the "Use tokens in session to initialize javascript" option checked in admin/build/fb/settings.
Give that a try and if it doesn't make difference I will take another look at that site's settings.
Comment #3
notluap commentedI have tried turning on "Use tokens in session to initialize javascript" as well as "Append hash on javascript page reload" but still have no success. I have also tried most other combinations of the options on that page, but also no success.
Any help would be great. Thanks!
Comment #4
notluap commentedI did some more testing and figured out the reason I was able to load the Drupal for Facebook canvas app is because I was an anonymous user. I tried a new Facebook account on my canvas app and was able to load the anonymous user page, but once I authorize the app and a user account is created in Drupal I am instantly thrown into an infinite reload.
Comment #5
Dave Cohen commentedAre you saying that http://apps.facebook.com/drupalforfacebook/ reloads infinitely when you connect to an account? You can do that by taking the tour. I just tried and it didn't infinitely reload for me.
Comment #6
notluap commentedYou're right. I registered successfully on the D4F canvas app and no infinite reload, but still have infinite reload on my apps. No idea why..... very frustrating.
Comment #7
Dave Cohen commentedJust looked things over again, trying to remember what I did...
Try settings $conf['session_inc'] in your settings.php, the same way I am on that site. Here's the end of my settings.php:
You probably need to replace "profiles/custom/modules/fb" with "sites/all/modules/fb".
Comment #8
notluap commentedThat worked for me, no more infinite reload.
However, after applying that code in Safari all my 'flags' on nodes using the Flag module when clicked give back a "bad token" error message.
If I allow third party cookies in Safari settings, the flag problem goes away, but that defeats the purpose of this fix. Any idea what might have caused this from the code?
Comment #9
Dave Cohen commentedYeah, the problem is that modules/fb is changing the session id when you're on a canvas page. This what you want, as you should not see the same session in both your regular site (say www.example.com) and your facebook app (say apps.facebook.com/example). It uses a url rewriting trick to accomplish this. Without the url rewriting, modules/fb can't tell the request is intended for a canvas page instead of a regular page.
flag is using ajax instead of regular links to do whatever is is doing. And when making an ajax request, it is not respecting the url rewriting. I'm not sure how that module works. It might be a bug in that module. Or it might be that the HTML with the flag is cached (ie it is in a block which drupal caches) and it got cached from a regular page load not a canvas page.
At least that is my guess. Your page is loaded using module/fb canvas page session, and flag is trying to accomplish some ajax using the regular site session.
Comment #10
notluap commentedI am having the same infinite reload issue again with canvas apps in Safari, including the official Drupal for Facebook app now too.
Loading the D4F app in Safari and the page infinitely reloads on the /frontpage page.
Turning on third party cookies fixes it, but adding the code to my settings.php from your previous post no longer stops the non stop refresh with cookies turned off.
Comment #11
notluap commentedDave, any insight into this issue?
Fresh Safari install, loading the Drupal for Facebook official canvas app or any of my apps I get an infinite reload on every page unless third party cookies are turned on.
The PHP code above used to fix this for me, but it looks like it no longer works on both our apps.
Comment #12
Dave Cohen commentedWhich version exactly of Safari?
Where are you logging into the Drupal for Facebook app? I.e. what's the browser's URL? Are you clicking a connect button or just logging into facebook?
I just tried and couldn't make it happen there.
Comment #13
notluap commentedReload is happening with both the latest Mac and PC versions of Safari.
I already had registered on the D4F app a while ago... clicking the app link after already being logged into Facebook brings me to https://apps.facebook.com/drupalforfacebook/frontpage which reloads infinitely unless I enable all cookies.
Comment #14
Dave Cohen commentedHopefully theres a better solution than this patch. While this patch limits the reloading, there is another reload any time a link is followed. And session is not persisted from one request to another. That's basically what Safari is trying to do. I'm not sure how best to work around this.
Comment #15
notluap commentedI applied the patch and it stopped the infinite reload... however, the page height resize javascript no longer works in Safari or IE with this patch enabled.
Edit: Needed to re-apply the resize patch, now it's working again.
Comment #16
Dave Cohen commentedThe page height problem probably indicates an error in javascript. I'm not sure whether safari has something like firebug to help track that down.
Comment #16.0
Dave Cohen commentedUpdated with better info