Jorge
Jorge

Reputation: 2066

Codeigniter - Facebook - JQuery Mobile problem

I'm working on an mobile web app that list user's friends to post on their walls. I'm using PHP SDK as FB Framework. When facebook redirects back to the original URL, it adds a query string. This is how the return URL in the browser address bar looks like:

http://mysyte.com/friends?state=11ccb40641675f22adc52aeff2562a0f&code=AQBsK6AipjCoQ96i00mHz5gJe4MqgxQCbRwZQKqHWngO8X54eyb3o1qZS7Hz0O335SVUVSUHT05M4xtC5FbTclFolxD7Z2rUM5m7zAvIx-TJN-V8aP1L6WtRMsqMWIWclHJZqWqsP9leyAs0H6HxSVvhH50ut8IKv7wowmojNmyW0pQtmUVAsLi0-8WTo-Y_xCg#_

When the view is loaded, JQuery mobile tries to call this:

"http://mysite.com/friends/_"

and it gets 404 from Codeigniter because the underscore. As a result of this i have a blank page.

I tried to fix this by changing the REQUEST_URI to PATH_INFO, enabling query strings and an empty string in permitted_uri_chars without any luck.

Also, when I print out the $_SERVER['REQUEST_URI'] I get:

/friends?state=11ccb40641675f22adc52aeff2562a0f&code=AQBsK6AipjCoQ96i00mHz5gJe4MqgxQCbRwZQKqHWngO8X54eyb3o1qZS7Hz0O335SVUVSUHT05M4xtC5FbTclFolxD7Z2rUM5m7zAvIx-TJN-V8aP1L6WtRMsqMWIWclHJZqWqsP9leyAs0H6HxSVvhH50ut8IKv7wowmojNmyW0pQtmUVAsLi0-8WTo-Y_xCg

(WITHOUT the trailing #_ as it looks in the browser address bar)

If I manually delete the #_ at the end in the browser, it loads ok again.

Any ideas?

Thanks.

Upvotes: 1

Views: 905

Answers (2)

J True
J True

Reputation: 21

I have encountered a similar problem with JQM and the url #hash. I was able to use the anchor tag's rel attribute:

<a href="http://website.com" rel="external">Link Me</a>

You may also want to try data-ajax="false"
AND/OR with the JQM changePage() method:

$.mobile.changePage(url, { changeHash:false });

Where url is the path as a String (relative or absolute).

As for the underscore, this is a big problem for CodeIgniter since any method starting with an _ is a private method.

Admittedly, I have never used the FaceBook PHP API. So, your problem may be out of my scope of knowledge.

Upvotes: 2

Chamilyan
Chamilyan

Reputation: 9423

Ah yes, the infamous hash symbol at the end of the URL bug. Let me guess, your testing this on an Android emulator using the built in webkit browser. It will work on an actual device, also try this on another emulator version.

I suspect that there is very little known about this, but Iv'e seen this little issue in several questions on SO and Iv'e encountered it in my own tests. There is definitely something wrong here.

Upvotes: 1

Related Questions