Facebook Application and URLs - ruby-on-rails

I developed a Facebook application using Ruby on Rails but I have a slightly annoying problem.
When I click any URL inside the application the application redirects to the correct view and everything is working just fine but the URL on the browser is not updating accordingly. The problem is that if I click refresh on the page I will be redirected to the home page of the directory ( that's correct because the URL in the browser is the home URL ) instead of the page that I was.
Example:
App URL:
https://apps.facebook.com/example
Clicking the books link is showing the page correctly but not modifying the browser's URL to:
https://apps.facebook.com/example/books
So next time that I will hit refresh I will be redirected to the home page because the browser link is still:
https://apps.facebook.com/example
Any suggestions?

you need to be aware that your app is an iframe app(i assume you didnt use FBML), that means it is contained in a iframe. So when you create your links, add a target=_top will change the url.

When You create a link You must define target with _parent like:
link

Related

Build web page request in Objective C

I'm building a native application. The app has an embedded webview (UIWebView) pointing to a social website. To be able to use the website inside the app, user has to log in by the webview (username/password) and then he can continue use the site with saved cookies. Normally, the cookies expire after two days. After that, the user has to re-login by the webview.
Now suppose I know username and password of the user and I would like to make the user login automatically with this account when the cookie expires. How can I do that?
I tried to simulate the Login action when I click on Login button on web page, but not successful.By using "Inspect Element" of Chrome, I can see Chrome makes a "Post" request to an URL with some parameters. However, the request doesn't get successful (I use REST client for testing).
Finally I found out the solution. I didn't build requests anymore. I used javascript to set text fields and make "click" action on the webview. Done.

logout does not work properly in struts2

i am developing a struts project.
In login page action stored username and password in session.
In logout action class using session.invalid and removed that session details and redirected to index page.
But i click back button in browser it goes to the previous page.
Now i need sample code for if i am clicking back button after logging out it will show the error message or it display index page like yahoo mail.
need sample for that in struts2
As I know, very hard to do JS side. because back button belong to web browser. Our project do below way:
When logout, close currently window and open new window. that will help you clear history.

Facebook app iframe won't attempt to load when logged in as page

I have an app that shows up as an iframe on a Page. (Here's an example.)
If you view the app tab as a Facebook user, whether you have the app installed or not, everything works correctly.
If you view the app tab as a Facebook Page that has not installed the app, everything works correctly.
If you view the app tab as a Facebook Page that has installed the app, nothing displays. In fact, when sniffing the HTTP headers, it looks like no attempt is ever made to load the app URL.
Any idea what needs to happen on the Facebook side of the equation in order to have the tab at least make an attempt to load the app's page?
Thanks!
This is now a desired behavior, once you trying to visit Application Tab by being logged in as Page you'll be prompted to use Facebook as regular user:
To access this page, you'll need to switch from using Facebook as your page to using Facebook as yourself.
BTW, this was described in bug Blank app page which is marked as fixed (and the described behavior sadly was a way to fix this)...

Facebook share and like are grabbing the title from the home page

Share and like are working perfectly on my other PHP site, but on my new Rails site, it is just posting the home page url and the title from the home page. It's also not grabbing any images when posting through FB share.
I tried everything - setting the og:title meta property, changing the href in the url param for share.php to facebook, etc.
What am I missing? Has anyone encountered this problem on RoR?
Thanks,
Bella
I think I know why. The page can't be views without a login. FB can't therefore see the page and is redirected to the log in page.

Restricting page url to be opened into another by simply copying and pasting

When i Copy my url after logging into another browser it displays the same page instead of login page .This happens even after i close my page
Modify your session handling. The session ID should not show up in the URL (or at least not be used alone for authorization of the request).

Resources