views:

377

answers:

2

Is it possible to write a website that uses Facebook connect without JavaScript? I have a site set up that works great using XFBML but this (obviously) fails when I visit with JavaScript disabled.

I have a feeling that this is possible using the REST-api for Facebook but I'd still appreciate some pointers. There was a discussion about this on the Facebook forum.

A: 

I'm want to do the same thing. I'm not worried about people without js though, but the facebook-js-files loads very slow and that slows down my whole site. Facebook doesn't work without js so i guess everyone who want to login with facebook on your site supports js.

But to the question. In the PHP-lib there is one method called get_login_url that you can use to get a sign-in-url for your app.

$connectUrl = $fb->get_login_url("http://www.yoursite.com/loggedin.php",0);

So you can make your own connect-button that links to that url. Once the user signed in facebook will redirect him back to the url you specify. If the user is already online on facebook he will be redirected back immediately.

What i'm still missing though is a possibility to check if a user is signed in on facebook already without forcing the user to click a login button. Havn't figured out any way to do that without javascript yet but i'll let you know if i find something.

Martin
A: 

Facebook works perfectly fine without js. It acts kind of similar to twitter's oauth process. check out facebook's mobile api.

to login using a PHP varible:

where $url_accept is where to send the user if they accept the login and $url_cancel if they decline.

$facebook_login_url = 'http://m.facebook.com/tos.php?api_key='.$FACEBOOK_API_KEY.'&v=1.0&next='.$url_accept.'&cancel='.$url_cancel;
Jayrox