| FBML has been deprecated. Starting June 1, 2012 FBML apps will no longer work as all FBML endpoints will be removed. If you are building a new application on Facebook.com, please implement your application using HTML, JavaScript and CSS. You can use our JavaScript SDK and Social Plugins to embedded many of the same social features available in FBML. |
Lets you tailor the enclosed content to display to specific ages, locations, or content types.
You should use this tag with fb:else so you can provide alternate content in case the viewing user doesn't meet the demographic requirements. Also, if the user hides their age for privacy reasons, Facebook cannot determine whether or not the content is visible to the user, and thus it cannot be displayed. In this case, your fb:else clause should contain content that any user who doesn't necessarily meet these restrictions could see.
Note: You cannot use the fb:restricted-to tag to send invitations and requests to a demographically-restricted set of users, as with fb:multi-friend-selector. Instead, use the admin.getRestrictionInfo and admin.setRestrictionInfo API calls to target those users for your application overall.
Note: If you want to restrict your entire application to a given set of demographic restrictions, use admin.setRestrictionInfo.
| Name | Type | Description |
|---|---|---|
| age | string | The valid age or age range that can see the content. To specify multiple age ranges, separate each entry with a comma. Every specified age must be an integer. You can use plus (+) and minus (-) to restrict content to that age or older/younger (like 21+ for 21 and older or 18- for younger than 19). You can also specify a range of ages, like 18-35 so anyone between the ages of 18 and 35 (inclusive) can see the content. You can also specify multiple age ranges (like 19-,30+ — if you want to exclude people in their 20s, for example). Every specified age must be an integer, and only the integer part of a user's age is taken into account. So for example, a user who is 17.9 years old will be treated as 17, and "18-35" includes anyone 18 or older but under 36. |
| location | string | The country or countries that can see the content. To specify multiple countries, separate each entry with a comma. When specifying the |
| age_distribution | array | An array containing |
| type | string | The type of content being filtered. You can specify |
Restricting content to users 17 and younger only.
<fb:restricted-to age="17-">Let's talk boy bands.
<fb:else>Cool, the kids are gone!</fb:else>
</fb:restricted-to>Restricting content to users 18 and older in Great Britain only.
<fb:restricted-to age="18+" location="gb">Remember to drive on the <i>correct</i> side of the road.
<fb:else>You're either not from Great Britain or you're from Great Britain but not 18 yet.</fb:else>
</fb:restricted-to>Specifying alcohol content to users in the United States only.
<fb:restricted-to location="us" type="alcohol">Enjoy a fine malt beverage.
<fb:else>Enjoy a nice soft drink.</fb:else>
</fb:restricted-to>