Facebook Comments with Ember Views in Subroute - facebook

I am trying to add the Facebook comment plugin to one of my subroutes, but the problem is that it is only shown when I refresh the page. As soon as I navigate somewhere else (= the view in which I added the snippet is removed) it is gone. Meaning when I navigate back to the same route, the Facebook Plugin is not reinitialized.
Is there a way to prevent it from being destroyed or maybe do some "FB.Init()" on route activation?

If you're using XFBML you can call
FB.XFBML.parse(document.getElementById('foo'));
Or call it without parameters, to do it on the entire page.

Related

Facebook Page Tabs position attribute stopped working

According this Facebook page tab documentation you can update the 'position' of the Tab by calling a http post as follows :
https://graph.facebook.com/v2.5/{pageId}/tabs?access_token={pageToken}
At this endpoint you can update a Page tab's position with the POST request, passing the parameter tab=TAB_NAME&position=TAB_POS.
This has stopped working recently (perhaps since Facebook rolled out page templates for Admins).
I am able to update the custom_name and image for the tab. And I can also see the 'position' attribute for the tab is changed to the new value. However the actual position of the Tab on the page does not change. Earlier calling the above post, would actually move the tab within the list of other tabs.
I am looking for help on what is the new way to change the tab position.
Thanks.
Facebook have acknowledged this as a bug on their platform and are close to deploying a fix : https://developers.facebook.com/bugs/1302804313113666/

How to find if web page got appended using chrome extension

I am new to chrome extension and I am trying to find whether page content got appended.
For E.g. in Facebook, we can see the content will appended automatically when the user scroll down the page.
I have the following code in background.js
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
alert("page is appending....");
});
The above code is expected to fire when the page got updated. But, I am seeing that it is getting called only for few times. Not always.
Or Am I making any mistake here ?
My requirement is, whenever the web page appended in facebook, I have to do get the page content and obtain few string from the same.
Thanks in advance.
Your onUpdated event is in the chrome.tabs namespace on purpose, it listens the updates of tab's general attributes like: the tab pinned, the favicon changed, the URL changed, see the documentation (also check the update() method). So this way is not workable. Instead listen the DOM tree change with DOMSubtreeModified event or MutationObserver.

Refresh Fb Comments Plugin

I'm trying to add a link to allow a user to refresh the Comments plugin on my page so they can see other posts by other people.
I want to do it without refreshing the full page.
There's a html5 player on the page playing audio, hence me not wanting to interrupt that player.
Currently I'm using the standard -
I've tried the jQuery method of giving the div an id and having a header script which counts to 10 and reloads the div widget, it seems to reload the widget, but it doesn't update the contents of the comments plugin to show other's posts, just ones you've added yourself. To see all the updates you have to refresh the page fully, which I don't want to do.
I'm trying to avoid iFrames because of the height issues and extra scroll bars, etc.
Any ideas would be appreciated
I'm not exactly sure what you're trying to do, but you can use the FB.XFBML.parse method to refresh plugins.
The only thing is that you'll need to first remove the old plugin from the dom, then add the new html5/xfbml placeholders (what you get from the comments plugin page when clicking "get code") and then use the FB.XFBML.parse method.

handle subpages inside facebook app (with one single tab)

My goal is that have a fb page app (only in one tab) and use it with linkable subpages inside it.
For example:
If I click on subpage link there would be a http or ajax request inside the iframe. Thats fine, i can do that.
BUT
in the solution I also want to implement these two features:
1.:
I want that page to be accessible directly from an url like:
http://facebook.com/pagename/app..blabla/subpage1
or
http://facebook.com/pagename/app..blabla&sk=535&subpage=1
or
http://facebook.com/pagename/app..blabla#subpage1
2.:
On subpage link click inside iframe I want the browser url to turn into something like mentioned in the 1. point. (even when using ajax - probably with a hash tag)
Is it possible?
If you look at the page tab tutorial http://developers.facebook.com/docs/appsonfacebook/pagetabs/ at the bottom of the page they describe how you can create the 'subpage' idea using the app_data parameter. So your links will look like http://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here
For your second question, in the links on the page you would specify target="_top" in any links you have with the href being: http://www.facebook.com/YourPage?v=app_1234567890&app_data=subpage1. This will cause the entire page tab to load through Facebook and you'll get the signed_request and your app_data parameters.
You probably don't want your ajax to load through facebook, because you'll get the Facebook page back instead of json or whatever you are trying to load. Instead you'll just make ajax calls to your server and pass the parameters you need to, like app_data or whatever you want.

How To stream.publish Within a Profile Tab

I have successfully setup an iFrame based App using the Javascript SDK, and we are trying to enable it on a Page Tab.
It seems Facebook has changed some things lately, because the app breaks when added to the Page Tab. I even went as far as making sure that all external scripts were included in the main index.php file, and that the body tags were taken out.
No, I'm trying to find out if it is even possible to use methods such as the stream.publish within a Profile Tab at all.
It seems like it isn't. As far as I can tell, you can no longer use any social methods on the Profile Tab.
Here were two related articles on the subject:
insidefacebook.com/2010/08/19/facebook-moving-toward-iframes-over-fbml-for-canvas-apps-and-page-tabs/
-and-
developers.facebook.com/roadmap
If anyone can confirm or deny this, it would be a huge help. The Facebook docs are just all over the place.
Here's a link to the working App Canvas as it stands now: http://apps.facebook.com/votetesting/
I know that on tab pages, you cannot do any JS until the user clicks on something first. Maybe that is the problem.
-Roozbeh