Browser independency with <if supports>
This section will deal with the <if supports> plugin and the page and client scopes.
After reading this section you will know about the many features that might be checked for with <if supports> and the properties of the page and client scopes and their entities.
The <if supports> plugin features
Have you ever met somebody that have produced a good looking web page for one browser and later found out that another browser smashes it up totally? With RXML you can easily check which features the browser requesting a page supports and send the content corresponding to that. You simply use the <if supports> plugin. Below follows a list of the different features this If plugin is able to check.
The syntax for Supports is
Page and client scopes
For displaying and/or getting information about the client browser the client scope is suitable. The following list is an extract of the many different entities available:
If information about a page is wanted, there is a convenient scope called page for such tasks. Some useful entities are:
For the complete list of entities of these scopes, insert
in a web page. Let's look at some examples:
A simple check for which browser is requesting this page.
entity contains the actual version supported. Clientvar plugin can be used for narrow test for
RXML run error: Emit dir couldn't find any contents. | <emit file="plugins.xml#ev" scope="file" source="dir">If plugins part, for details and an example.
Ok, let's get down to work.
We simply insert a link leading to the message form in HTML version. It is a basic form with no tests of input or other funny stuff. (We don't comment the form here. Have a look in the source code if you are curious. The file is named message.xml.)
The user adds name, mail address and a message, clicks 'SEND' and the pop-up window disappears and data is submitted and handled in some way by the server. In this example we simply display it in the browser. The message will be displayed the same way if the HTML form is used instead.
Well, that's it. This was just a simple example of the powers of <if supports>. As shown in the former parts, there are many features that may be checked for and dynamically handled.
This section has taught you how to check for which facilties the browser requesting the web page supports and how to adjust the sent information according to that. The page and client scopes where also discussed. The syntax for supports is
More details about <if supports> and client and page scopes are found in the Web Site Creator Manual or adding <help for="if" /> in a web page.