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