Adding history states in a backbone.js Facebook app (in iframe)

Viewed 2392

I am developing a Facebook app that uses backbone.js 0.3.3 and am trying to get the back button to work properly for users.

Backbone saves the state through the URL hash, which is used to do internal routing. For example, #home will load the homepage and #session is another page. History is saved when this happens outside an iframe, so you can navigate correctly using the back button.

Navigation inside the iframe is not the problem, and all the links work, but no history is saved by the browser.

The question:

The Facebook iframe points to http://app.example.com, which is the Backbone application. How can I get the back button to work for the user on the Facebook app? Bonus points for an existing solution using Backbone.


I have looked into this question from several angles and can't find a satisfactory solution available anywhere. It seems like very few Facebook apps use backbone/rely so much on Javascript.

I think that the solution is to add history states to the parent window of the iframe, but I don't know how to do that. HTML5 history? Some sort of Facebook API? Even a partial solution (for modern browsers) is preferable to the current situation.

1 Answers
Related