My facebook application redirects the user a page where they give the application window correctly when they visit the website (http://toolshed.herokuapp.com/), but not when they visit the canvas page in Facebook (https://apps.facebook.com/toolshed/). Once a user has given permission to the application, both places work correctly. The main problem here is that when a user goes to the page on Facebook first, all they see is a blank page. Any ideas? The code can be found at https://github.com/runninggraeb/toolshed, but I doubt it's a coding issue. Any help would be appreciated.
Ryan
Answer: To clarify to future viewers, I did redirected to this page within the app for authentication. "top.window.location" gets me out of the iFrame.
<!DOCTYPE html >
<html xmlns:fb="http://ogp.me/ns/fb#" lang="en">
<script>
window.top.location = '<%= authenticator.url_for_oauth_code %>'
</script>
</html>
You can not display the Auth dialog in any kind of frame. (As has been said here already many times before …)
You have to redirect to it in the top most window instance.
Related
I am trying to add an app to my facebook fan page account for oAuth login.
I DONT WANT A TAB so the method i thought might work was method: 'apprequests'
but i keep getting an error: An error occurred with Prayerfish Login. Please try again later.
any suggestions on how to get the app over to my fan page?
note** this html page is from facebooks tutorial
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title>My Add to Page Dialog Page</title>
</head>
<body>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<p><a onclick='addToPage(); return false;'>Add to Page</a></p>
<p id='msg'></p>
<script>
FB.init({appId: "****************", status: true, cookie: true});
function addToPage() {
// calling the API ...
var obj = {
//method: 'pagetab',
method: 'apprequests',
redirect_uri: 'https://www.myDomain.com',
};
FB.ui(obj);
}
</script>
</body>
</html>
The only way to have an app on a Facebook Page is to add it as a "tab". Since the switch to Timeline, tab has become a bit of a misnomer as it is more correct that it is just a bookmark at the top of your Page (for example on Spotify's Page the 'Get Spotify', 'Fan Playlist' and 'Summer Sounds' thumbnails at the top of the page are technically 'Page Tabs').
If you still want to add the app to your Page as a 'tab', the code you included above is actually more complex than you need. That code is what you would include on your website, for example, if you wanted to allow admins of other Facebook Pages to install your app. Because you own both the Page and the app, you just need to modify this link to include your app ID and URL and click on it:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&display=popup&next=YOUR_APP_URL
When you do, you'll see a dialog asking you to pick which Page you want to add the app to, choose that and you're done.
If you were already aware of what a Page Tab is and don't want that, my question would be - how do you want the app to appear?
My app is my website so I used to put this code in my canvas page so I redirect my users to my website :
<fb:redirect url="http://www.mywebsite.com/" />
but since fbml has been deprecated and will not be supported anymore soon I need to use another method to redirect my users .. is the following code the best I can do or there is another way?
<script type='text/javascript'>top.location.href = 'http://www.mywebsite.com/';</script>
That's right. You can only do a top.location since you are inside an iframe. See more here: Redirect from Facebook canvas page to website
I want to capture Like button click event in facebook page in my facebook.
http://www.facebook.com/wineselectors
If anyone click on like button, it should open a popup window of page tab http://www.facebook.com/wineselectors?sk=app_190348341034091
I have used to below code to capture like click, but it is not working.
<html> <script type="text/javascript">
FB.Event.subscribe('edge.create', function(response) {
alert('the user likes a page');
});
</script> <body> <center> <img src="http://www.wineselectors.com.au/images/UserUploadedImages/facebook-like--image.jpg" /> </center> </body> </html>
I am trying to develop an aspx page for welcome tab but how can I get signed_request in my aspx page and how to decode the signed_request. I have read some of the articles they were using Jason but i could not able to use Jason in my system.
When someone likes your page, the page gets completely refreshed and you would need to decode and inspect the signed_request HTTP POST parameter in server code (not javascript) to see if they like your page. Then from there you could redirect the user as necessary.
I have a facebook application and when it posts to a users stream it shows the application name and clicking that directs the user to the applications profile page. Is it possible to change this link to another page or set the application profile page to load another page?
I'm not sure about changing the link but you can make one page automatically load another page.
See an example on our fan page here: http://www.facebook.com/pages/Premier-League-Prophet/193957803989227
When you visit this page it automatically redirects to our app profile page instead at http://www.facebook.com/apps/application.php?id=105260882892290
1) Add the "Static HTML: iframe tabs" app to your page. This lets you configure any static HTML as the source for a page tab.
2) Use a quick bit of redirect code so that when the tab loads it automatically redirects the browser to where you want to go:
<html>
<head>
</head>
<body>
<script language="JavaScript">
// Redirect to chosen destination
top.location.href = "http://www.googl.com/";
</script>
</body>
</html>
3) In the page config, set the new tab as the default tab for the page.
One small limitation. The default tab setting is only respected if the user has not yet liked the page. If they have liked the page, then the wall is displayed by default. However, if you're configuring the page to auto-redirect, this shouldn't be a problem, because no visitor to the page will stay on it long enough to like it.
I'm having a problem with the good ol' facebook like button on my site. I've implemented it all, I can click on "like" and it appears on my wall (and on the site the count pops up to say "1"), but the count never updates. If I refresh the page it just shows the "like" button again (no count), and if I log in to facebook with a new account and click on like again, it just says "1" again.
An example page on my site:
http://www.makemeacocktail.com/recipe/6741/
The fql readout (watch the apostrophe escape here, copy and paste dont just click):
https://api.facebook.com/method/fql.query?query=select%20total_count,like_count,comment_count,share_count,click_count%20from%20link_stat%20where%20url='http://www.makemeacocktail.com/recipe/6741/'&format=json
The FB XML that is being used:
<fb:like href="http://www.makemeacocktail.com/recipe/6741/" send="false" layout="button_count" width="50" show_faces="false" font="arial"></fb:like>
Other facebook thoughts etc:
I've got the facebook open graph meta data in the head
The js call to facebook happens as the last thing on my page, after the FBML:
<script src="http://connect.facebook.net/en_US/all.js#appId=187430904631019&xfbml=1"></script>
<script>
FB.init({
appId : '187430904631019',
status : true,
cookie : true,
xfbml : true
});
</script>
I've also got the facebook page like at the bottom of my page:
<div id="fb-root"></div><fb:like-box href="http://www.facebook.com/makemeacocktail" width="292" show_faces="false" stream="false" header="true"></fb:like-box>
Which is where the fb-root is.
My only thought it something about fb-root not being next to the facebook like button earlier up, and a conflict of two facebook like buttons or something? I;m only calling the facebook js once though, right at the bottom.
Any thoughts help etc much appreciated. It is weird because it it going to my wall, but the button on the site isn't listening!
Thanks a lot
Got this from the request your like button sends to facebook:
App ID does not match domain","full":"The app ID specified
within the \"fb:app_id\" meta tag is
not allowed on this domain. You must
setup the Connect Base Domains for
your app to be a prefix of
http:\/\/www.makemeacocktail.com\/recipe\/6741\/
So, you need to change the base domain for your application in the developers application to makemeacocktail.com. If that is not the problem try removing the fb:app_id open graph tag, or use the fb:admins tag instead. Good luck, hope this helps.