While creating a mobile web app with the Facebook javascript SDK, I have one iphone (4, ios5) that is receiving a QUOTA_EXCEEDED_ERR during FB.init. My FB.init looks like:
var channel = '//'+(window.location.hostname+((~[80,443].indexOf(window.location.port))?'':(':'+window.location.port))+'/channel.html');
var APP_ID = 'MYAPPIDXXX';
alert('before FB.init');
FB.init({
appId: APP_ID,
channelUrl: channel,
status: true,
cookie: true,
xfbml: true,
oauth: true
});
alert('after FB.init');
This error seems to be related to localStorage, however after clearing cache on the phone the error still occurs.
I can reproduce (only on that one phone) with an html page that only has the fb-root element and the '//connect.facebook.net/en_US/all.js' script followed by the script above. I am using the html5 doctype and including the facebook namespace in the html tag. It never reaches the second alert. My channel file exists and is being served correctly.
Any ideas as to why this is happening?
Thanks
Found the answer here:
http://frederictorres.blogspot.com/2011/11/quotaexceedederr-with-safari-mobile.html
Turns out that iphone in question had "Private Browsing" enabled in the Safari settings. You can detect private browsing by trying to set an empty string to local storage and checking for a QUOTA_EXCEEDED_ERR as shown here:
http://m.cg/post/13095478393/detect-private-browsing-mode-in-mobile-safari-on-ios5
Related
I can initiate dialog to send a link to Facebook Messenger. Everything goes fine and recepient gets the message with URL. However, when a message is added in Facebook's UI, only that message is received and URL NOT.
Message field causes link to be ignored in received message
Desktop
I have tried both methods according to
https://developers.facebook.com/docs/sharing/reference/send-dialog/
URL
https://www.facebook.com/dialog/send?display=page&link=https://developers.facebook.com/docs/sharing/reference/send-dialog&redirect_uri=https://www.facebook.com&app_id=<APP_ID>
SDK
window.fbAsyncInit = function () {
FB.init({
appId: '<APP_ID>',
autoLogAppEvents: true,
xfbml: true,
version: 'v11.0',
});
};
FB.ui({
method: 'send',
link: 'https://developers.facebook.com/docs/sharing/reference/send-dialog/',
});
I have tried different SDK versions and different APP IDs.
Mobile
Curriosly so, my setup for mobile works fine, link is received with or without a message.
fb-messenger://share?=<APP_ID>&link=<MY_LINK>
I am really confused as there does not seem much to configure... Thanks in advance for any leads on this.
It has been acknowledged as a bug by Facebook already in May https://developers.facebook.com/support/bugs/201777038410094/
Again reported in July
https://developers.facebook.com/support/bugs/2934678630125393/?join_id=f3c21b71e26d8c
For a contest page, I use Page Tab within a Facebook App, but I can't set a Share dialog without getting this error.
window.fbAsyncInit = function()
{
FB.init({ appId: '##### (correctly set)',
status: true,
cookie: true,
xfbml: true,
oauth: true});
FB.Canvas.setAutoGrow();
}
window.fbAsyncInit = function()
{
FB.ui({
method: 'feed',
name:'name',
link:'https://expertsmo.ca/_fb/concours/1', // https://apps.facebook.com/expertsmo
caption:'test'
});
}
Here is the App conf
I checked many posts on this error code, most of these problems are caused by the URL not being set; in my case, URL is well set and I still get this error. I tried many many things, still not working ( this solution of a similar case doesn't seem to work because I can't find the field "Website With Facebook Login").
I also use PHP sdk to find out if the user likes the page already, or not.
Really, I can't find the solution to this problem ... any idea? Thanks...
You include the JavaScript SDK two times in the code, only one time with an App ID (that is different from the FB.init call). Make sure you are using the latest code from the Facebook docs and clean up old stuff. That error message comes up when the App ID is not correct, the settings should be fine.
https://developers.facebook.com/docs/javascript/quickstart/v2.0
You also use window.fbAsyncInit in a wrong way, this should only be used once when you open the page. FB.ui should get called on user interaction or you will also get problems with popup blockers.
Btw, you should put ALL JavaScript code right before the closing body tag (for many reasons). Not sure why you put the async function after the opening body tag.
I am running into a problem with logging in to Facebook on Safari and IE. I can login just fine with Chrome and Firefox with the following code:
var appId = 'APP ID';
var uid;
// Initialize the JS SDK
FB.init({
appId: appId,
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
channelUrl: '//localhost:8888/photo/channel.html' // Channel File
});
// Get the user's UID
FB.getLoginStatus(function(response) {
uid = response.authResponse.userID ? response.authResponse.userID : null;
console.info(uid);
});
function authUser() {
FB.login(function(response) {
console.info(response);
uid = response.authResponse.userID ? response.authResponse.userID : null;
console.info("called");
}, {scope:'email,publish_actions'});
but when my code gets to FB.getLoginStatus on Safari and IE the response shows
authResponse: undefined
status: "unknown"
Edit: Forgot to mention that the popup that shows the permissions is not popping up in Safari and IE.
If the status is "unknown" that means one of two things:
the user is not logged in, or
third party cookies are disabled
Safari is the only browser to come with third-party cookies disabled by default (Firefox will be following suit shortly). Some of the higher security settings in IE will also turn them off. Since your code is working in Firefox/Chrome I would guess this is the culprit.
Unfortunately, third-party cookies are required for FB.getLoginStatus to return an appropriate authResponse and status. I think your options are pretty limited:
Let the user log in through PHP or another back-end SDK, and force them to sign in again every 2 hours (I think FB tokens expire every 7600 seconds)
Detect the "unknown" status and display a message to the user asking them to enable third-party cookies for facebook.com
I didn't actually fix the problem I was able to get around it by running the app on Facebook instead of my localhost. I believe this is because when on Facebook I am already logged in.
I have a mobile web site using Facebook Connect to authenticate user. I encountered a problem login with Opera Mobile. I have below javascript to detect login status, but only in Opera Mobile the callback is not firing. Is anyone encountered this problem?
window.fbAsyncInit = function () {
FB.init({
appId: 'xxxx',
channelUrl: 'http://xxxx/channel.html',
status: true,
cookie: true,
xfbml: true
});
FB.Event.subscribe('auth.statusChange', handleStatusChange);
};
function handleStatusChange(response) { // --> NOT FIRE
if (response.authResponse) {
//Login, show Logout button
}
else {
//Show Login button
}
}
Please make sure you put the JS tags and other required HTML in a logical order (if you use an fb-root element put the scripts after it, try putting them inside BODY if they are currently in HEAD). I've seen FB login fail because the tags were in the wrong order, and because some browsers do "speculative parsing" this cause of random cross-browser malfunction may not be immediately obvious. (Besides, you create a race condition that might break in any browser if the network has a hiccup and the timing of loading stuff is unexpected..)
If you still have problems it would be useful to get a link or a demo to look at. We've tested a random page that uses FB Connect and worked fine. Apart from tag order issues I can't guess what might go wrong for you here.
Opera Mobile has new release today (12.10.ADR-1210081231). It solved the Facebook login issue, but there is a minor issue. The Facebook windows will not close automatically after user login.
I am trying to use the fb:registration XFBML tag. For the most part it seems to work; however, when I click the 'X' in the name field and then click 'Log Out' I get the error message
Invalid 'client_id'.
Although this error occurs, it seems the actual log-out process was successful; if I manually refresh the page I get the form in its logged-out state. I tried getting around this issue by subscribing to auth.logout events and reloading the page, but the error prevents the events from being triggered until after a page reload.
Using firebug, I have found that the actual javascript error is FB.getSession incompatible with OAuth2 and it is called on line 9 of connect.facebook.net/en_US/all.js. I am not calling anything involving sessions, so I am not really sure why this is happening.
I have tried using firefox, chrome, and safari, and all three experience the problem. Additionally, on safari and chrome I also get the same error when I try to login with the registration plugin. If I manually refresh the error goes away and the login process is successful, just like with logout.
I am running this locally while in development, and so I made a facebook app just for testing with the site URL and domain referencing localhost. I am not in sandbox mode, and I am loading the js sdk like this:
<div id="fb-root"></div>
<script src="{$pageProtocol}connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId: {$facebookAppId},
cookie: true,
xfbml: true,
status: true,
channelUrl: '{$pageProtocol}{$webhost}/{$channel}',
oauth: true
});
(This is called from a smarty template; I have looked at the generated source and all of the {$var} bits get replaced correctly.)
Here is my xfbml tag:
<fb:registration
redirect-uri="http://localhost:8888/join?with=facebook&done=true"
fields='[{"name":"name"},
{"name":"email"},
{"name":"city", "description":"City", "type":"select", "options":{
"_98":"Albany / Capital Region",
"_3":"Albuquerque",
"_99":"Allentown / Reading"
}
}
fb_only = true
>
</fb:registration>
(I shortened the list of cities above.)
So if anyone can figure out what I am doing wrong please let me know.
Pictures:
from this modal: http://i.stack.imgur.com/sVN1E.png
click Log Out and you get: http://i.stack.imgur.com/eiLwY.png