Facebook Developers
DocumentationSupportBlogAppsLog In
  • Getting Started
  • Core Concepts
  • Advanced Topics
    • Dialogs
    • FQL
    • Internationalization
    • Ads API
    • Credits
    • Chat API
    • Legacy REST API
    • Legacy FBML
    • Legacy FBJS
    • Legacy Javascript SDK
  • SDK Reference
  • Tools
  • Tools
    • fb:board
    • fb:bookmark
    • fb:chat-invite
    • fb:comments
    • fb:default
    • fb:else
    • fb:feed
    • fb:friend-selector
    • fb:google-analytics
    • fb:if
    • fb:if-multiple-actors
    • fb:multi-friend-input
    • fb:quantcast
    • fb:random
    • fb:random-option
    • fb:switch
    • fb:typeahead-input
    • fb:typeahead-option
    • fb:user-agent
  • User/Groups
    • fb:eventlink
    • fb:grouplink
    • fb:if-can-see
    • fb:if-can-see-photo
    • fb:if-is-app-user
    • fb:if-is-friends-with-viewer
    • fb:if-is-group-member
    • fb:if-is-user
    • fb:if-is-verified
    • fb:name
    • fb:profile-pic
    • fb:pronoun
    • fb:user
    • fb:user-status
  • Notifications and Requests
    • fb:application-name
    • fb:multi-friend-selector
    • fb:multi-friend-selector_(condensed)
    • fb:req-choice
    • fb:request-form
    • fb:request-form-submit
  • Platform Internationalization
    • fb:date
    • fb:fbml-attribute
    • fb:intl
    • fb:intl-token
    • fb:tag
    • fb:tag-attribute
    • fb:tag-body
    • fb:window-title
  • Deprecated
    • fb:if-is-own-profile
    • fb:if-user-has-added-app
    • fb:networklink
    • fb:notif-email
    • fb:notif-page
    • fb:notif-subject
    • fb:profile-action
    • fb:rock-the-vote
    • fb:userlink
    • fb:visible-to-added-app-users
    • fb:visible-to-user
  • Status Messages
    • fb:error
    • fb:explanation
    • fb:message
    • fb:success
  • Page Navigation
    • fb:create-button
    • fb:dashboard
    • fb:header
    • fb:header-title
    • fb:help
    • fb:mediaheader
    • fb:owner-action
    • fb:tab-item
    • fb:tabs
  • Wall
    • fb:wall
    • fb:wallpost
    • fb:wallpost-action
  • Visibility on Profile
    • fb:18-plus
    • fb:21-plus
    • fb:restricted-to
    • fb:visible-to-app-users
    • fb:visible-to-connection
    • fb:visible-to-friends
    • fb:visible-to-owner
  • Profile-specific
    • fb:action
    • fb:add-section-button
    • fb:if-section-not-added
    • fb:narrow
    • fb:publisher-link
    • fb:subtitle
    • fb:user-item
    • fb:user-table
    • fb:wide
  • Misc
    • fb:add-profile-tab
    • fb:fbml
    • fb:fbmlversion
    • fb:js-string
    • fb:page-admin-edit-header
    • fb:redirect
    • fb:ref
    • fb:serverFbml
    • fb:time
    • fb:title
  • Editor Display
    • fb:editor
    • fb:editor-button
    • fb:editor-buttonset
    • fb:editor-cancel
    • fb:editor-custom
    • fb:editor-date
    • fb:editor-divider
    • fb:editor-month
    • fb:editor-text
    • fb:editor-textarea
    • fb:editor-time
  • Embedded Media
    • fb:flv
    • fb:iframe
    • fb:mp3
    • fb:photo
    • fb:silverlight
    • fb:swf
  • Dialog
    • fb:dialog
    • fb:dialog-button
    • fb:dialog-content
    • fb:dialog-title
  • Additional Permissions
    • fb:prompt-permission
  • Social Plugins
    • fb:comments
    • fb:live-stream
  • Message Attachments
    • fb:attachment-preview
  • Forms
    • fb:captcha
    • fb:submit
  • Reference
    • JavaScript SDK

fb:restricted-to

Advanced Topics › Legacy FBML › fb:restricted-to
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.

Parameters

NameTypeDescription
agestring

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.

locationstring

The country or countries that can see the content. To specify multiple countries, separate each entry with a comma. When specifying the location, specify the country or countries (using a comma-separated list) from the ISO 3166 alpha 2 code list. This list is not necessarily the same as the IANA ccTLD (country code top level domain) list. For example, the ISO 3166 entry for England is .gb, while the IANA entry is .uk.

age_distributionarray

An array containing age and location restrictions for multiple areas.

typestring

The type of content being filtered. You can specify alcohol at this time. Before rendering your FBML, we run a check against the type on Facebook, and if the user meets the age and location requirements, we'll render the content.

Examples

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>
Updated about 4 months ago
Facebook © 2012 · English (US)
AboutCareersPlatform PoliciesPrivacy Policy