Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I test my facebook page tab app from localhost

Tags:

facebook

I'm developing a facebook page tab app. When I set page tab URL in app settings to something like localhost/fbapp, it doesn't work since the page tab is not simply iframe. Is there any workaround to resolve this?

EDIT

I'm building facebook page tab with ASP.NET MVC-3.0 with fb C# SDK.

What I've tried so far is to modify hosts file to point the URL I have on app settings to localhost(127.0.0.1). I've been testing facebook app in this way always but it doesn't work in facebook page tab.

like image 736
mask8 Avatar asked Oct 06 '22 20:10

mask8


2 Answers

In Application setting in page tab url set

http://localhost/yourpagetabdir/

setting on facebook

I am using this setting for my page application test frmlocalhost its works fine from my ASP.Net Development server if you are using IIS server make sure your IIS server allow page in iframe.

after this if u want to get page-signed request

 Facebook.FacebookConfigurationSection s = new FacebookConfigurationSection();
                s.AppId = "AppID";
                s.AppSecret = "Secret";
                FacebookWebContext wc = new FacebookWebContext(s);
                dynamic da = wc.SignedRequest.Data;
                dynamic page = da.page;
                string curpageid = page.id;
                bool isLiked = page.liked;
                bool isAdmin = page.admin;
like image 174
Anant Dabhi Avatar answered Oct 11 '22 14:10

Anant Dabhi


Try editing your hosts file so that when you go to http://example.com it links to your http://localhost/yourapp

Here's how to do it:

  • Windows: http://www.trailheadinteractive.com/creating_multiple_virtual_sites_a_single_apache_install_windows_xp (your localhost URL should have a valid website format: 127.0.0.1 dummydomainname.tld)
  • MacOS: http://danilo.ariadoss.com/how-to-setup-virtual-hosts-mamp-environment/ (again, make sure you have a valid website format)
  • Linux: You probably know how to do this already :)

This should work as then the iframe would point to a valid URL, which on your local machine would point to your content. Note that this won't work if you access the tab from other computers since for them the URL would point to something else (or nothing, depending on what domain name you choose).

like image 22
Claudiu Avatar answered Oct 11 '22 15:10

Claudiu