Posts from — June 2012
Pitfalls of Facebook Page Tabs
I recently had occasion to create a couple of Facebook Apps for a client, to be accessed from tabs under the main timeline image on a business page.
There are plenty of tutorials around on how to do this, but I found a couple of pitfalls that don’t seem to be mentioned in the writeups I’ve seen.
Facebook Page Tabs
One of the many things that has changed about Facebook recently is the way that tabs on Business Pages are handled — this happened from April this year.
To begin with, you can no longer set up a tab as a landing page so non-fans who arrive at the page see it automatically: tabs are simply listed with thumbnail images under the header image. And while the content was previously limited to 520px width, you can now choose 810px wide as an alternative.
I was creating the very simplest of Facebook Apps: ones that simply call what is essentially a web page that gets embedded in a Facebook page with the Facebook equivalent of an iframe. The basic tutorial on this provided by Facebook can be found here.
To do this, you log into Facebook as a Developer (https://developers.facebook.com) using your usual credentials. Just to right of centre in the blue Facebook strip at the top of the page you’ll see “Apps”. Click this link and it shows you any apps you have created previously and there’s a button top right called “Create New App”.
As described in the tutorials, you need to give your new app a Display Name that appears beneath it on the Page; a unique Namespace; and a support contact email address. Then from the pop-up menu “Category”, choose “Apps for Pages”. For this simple app, that’s all you need in the top section. The tricky bit is next.
Selecting how your app integrates with Facebook
You now select how your app integrates with Facebook. Selecting “Page Tab” is obvious. You give the Page Tab a name; and supply secure and non-secure URLs. These point at the web location where the HTML content you want to display inserted on the Facebook page can be found. Providing a secure URL (ie one accessed via https:) is mandatory. It doesn’t seem to matter if the two URLs point to the same place, but I would suggest it’s a lot easier if they can, and your server is set up to serve both secure and non-secure content.
It may not be obligatory, but it turns out to be simplest if the URLs point to a directory in which the desired content is the default page: in other words, call your page “index.html” or whatever your server is set up to serve as default, and put it in a directory, for example one named after the application. So you might have a URL like “http://myserver.com/facebook/welcome/” — in other words, the URL points at a directory. This is what you want to enter into the Page Tab URL slot: with the forward-slash on the end.
You don’t need to provide a page tab edit URL. What you probably will want to include is a 111 x 74px image to appear in the box under the header on the main Facebook Page.
In addition, select the width of the inserted HTML material. You can use the original 520px width or the new 810px. Remember that whichever you choose, the HTML will be displayed on a blank white page with a Facebook blue strip at the top and little else: it should work visually in this environment. It turns out that the width is not quite as straightforward as it appears, as will be seen below.
On the face of it, you’re now done as far as the Facebook side of the setup is concerned. Wrong. There is another step you need to take, and that is to click the check-mark next to “App on Facebook”. This asks you to enter Canvas URL and Secure Canvas URL. Enter exactly the same URLs as you used above. This step is not obvious (don’t you just need to select Page Tab? No.) but if you don’t do it, you will get an error 191 when you try to add the App to a page. I have not seen this documented anywhere: have you? And if you look up Error 191, you’ll find that absolutely everyone gets this error and that nobody has suggested that filling in the “App on Facebook” tab is the solution, or what should go in there.
Once the above has been completed, you can go off and create your mini-pages that will be stored at the URLs above and will be displayed in an iframe on the Facebook page when visitors click on your app tab.
You can create the HTML in your favourite editor: I use Dreamweaver, but you can even create it in the Post Editor in WordPress, then click the HTML tab in the Editor and copy the code out, save it in a file with the right name, and upload it to the server.
In my case I had a 520px-wide x 775px high image and I simply placed it centred on the page and created a local image map to allow me to make it clickable, with different parts of the image taking visitors to different URLs on the client’s main web site. The client’s format involves black backgrounds, and the image had this, so I set the page background colour to black too, just in case. This proved to be inadvisable.
Adding the App to a Page
Once the page content is in position on your server, you are essentially done, and you can go back to Facebook and enter the special URL that allows you to select which of the Pages you administer the App should be added to. Why this isn’t easier is beyond me. A button would have been nice. The URL is:
https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&next=YOUR_URL
You get the App ID from the Settings page of your App, in the top section. The “Your URL” is the tricky bit. It’s the Canvas URL, and this is why it needs to be there. If it isn’t, then whatever you put in there, you’ll get the 191 error, which seems to relate to where the app redirects you to when you click on it.
All being well, though, you will get a nice little page that allows you to choose one of the pages you administer and add the App to the Page. You can then go to the Page and move the order of the tabs around to suit you (the “Photos” tab has to be first, for some reason, but you can move the others by swapping them around).
When 520px is actually 512
If you created the page the way I described above, with an image and imagemap, you will notice straight away that it hasn’t quite worked. The same is true if you sliced your image into bits, each with its own linked, and positioned them with a table. You will (probably, I assume it wasn’t just me) see horizontal and vertical scroll bars. WTF?
By simply reducing the width one pixel at a time I discovered that both scroll bars go away if you set the width to 512px. Nowhere have I seen this documented, so I would be fascinated to know under what circumstances this appears. So I trimmed the image a little so that it was 512px wide and lo! It worked!
And now you run into another little aesthetic issue. You’ll recall that I had my image on a black background. So I look at my image on the Facebook page and I notice a black strip down the left-hand side. It turns out that this strip is 8px wide. Hmmm. The image has to be 512 or it shows scroll bars, but it is placed in a 520px-wide space. Odd. Not only that, the image is ranged right in the space, even though the HTML centres it on the page. This appears to be the case whatever image positioning you use.
As a result, I had to remove the black background from the page, instead setting it to white, the background colour of the Facebook page. Nobody will notice that the image is 8px to the right.
June 15, 2012 Comments Off on Pitfalls of Facebook Page Tabs