Name

<fb:user-agent/>

Synopsis

<fb:user-agent [includes="..."|excludes="..."]>...</fb:user-agent>

Renders the content within the tags only if it is viewed with the specified browser or browsers. You can also use this tag so that content renders only if it is viewed in all browsers except a specified browser or browsers.

FBML-Specific Attributes

Required

This tag must contain at least one or both of the following attributes:

includes=[comma-separated list of one or more user agents] default: none

Specified group of browsers to display content for. Accepts either one value or a comma-separated list of values. See http://www.user-agents.org/index.shtml for a list of user-agent strings that can be used here.

excludes=[comma-separated list of one or more user agents] default: none

The network ID (nid) to test against. If the user is not in this network, either the content within the <fb:else/> tags is rendered or no content is rendered at all.

Optional

None.

Example FBML

Let’s say you want to render a message only to users of Mozilla Firefox. You would write your FBML code like this:

<fb:user-agent includes="firefox">
    We love Firefox users!
</fb:user-agent>

If you want to render a message to everyone except Internet Explorer (IE) users, you would write this:

<fb:user-agent excludes="ie">
    You picked a great browser that works well with our app!
</fb:user-agent>

To get really tricky, let’s display a message to all IE users except those who use IE 5.0:

<fb:user-agent includes="ie" excludes="ie 5">
    We like all versions of IE, except version 5.
</fb:user-agent>

Rendered HTML for Single Instance of Tag

So, for the first example just shown, let’s say you’re a Firefox user and you visit the app. The following message would be displayed:

We love Firefox users!

All other browsers would display nothing. For the second example, if you were using an Internet Explorer-based browser, the app would show nothing. However, all other browsers would show this:

You picked a great browser that works well with our app!

The third example would not display anything unless you were using a version of Internet Explorer other than version 5.0. All other versions of Internet Explorer would display this:

We like all versions of IE, except version 5.

Additional Information

  • When both includes and excludes are used together, the order of priority is includes first, then excludes.

  • You can use shortcuts for the most common user-agent strings, but Facebook’s documentation leaves it unclear what these shortcuts are other than “ie,” “firefox,” and “mozilla.” You seem to be able to treat the names broadly—as long as the user-agent name contains the shortcut that you enter, it is considered a match and should work. As more information about this tag comes to light, I will update this book’s Facebook Page (http://page.fbmlessentials.com).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.111.197