rules - Redirection Rules

Specifies rules for opening a page.

Category

basics

Syntax

<xe:this.rules>
	<xe:redirectPhoneRule attributes>content</xe:redirectPhoneRule> |
	<xe:redirectTabletRule attributes>content</xe:redirectTabletRule> |
	<xe:redirectHeaderRule attributes>content</xe:redirectHeaderRule> |
	<xe:redirectCustomRule attributes>content</xe:redirectCustomRule>
	...
</xe:this.rules>
Table 1. Properties for each rule
Property Description
disableRequestParams="true|false" Disables the copying of request parameters into the URL for the target page. Defaults to false.
<xe:this.extraParams>
	<xp:parameter
		name="param" value="val" loaded="true|false">
	</xp:parameter>
	...
</xe:this.extraParams>
Extra parameters appended to the target URL.
header="User-Agent | Accept" (xe:redirectHeaderRule only) Request header to match against headerPattern. Defaults to User-Agent.
headerPattern="regexp" (xe:redirectHeaderRule only) Request header pattern as a regular expression if type is custom.
loaded="true|false" Whether the tag instance should be created when the page is loading. Defaults to true.
url="page.xsp" Target URL, typically the name of an XPage with the extension .xsp.
urlHash="hash" A string prefixed with # and appended to url for specifying mobile pages like #document and #topic.

Usage

In Design mode, click All Properties and look for rules under basics.
The first matching rule determines the target page:
  • redirectPhoneRule (Redirect Phone Rule) redirects to another page when the browser is on a mobile device.
  • redirectTabletRule (Redirect Tablet Rule) redirects to another page when the browser is on a tablet device.
  • redirectHeaderRule (Redirect Header Rule) redirects to another page when a header matches a specified pattern.
  • redirectCustomRule (Redirect Custom Rule) redirects to another page when the redirect property evaluates to true.

Examples

This example redirects the current page to mobile.xsp#document if the requesting device is a mobile phone or tablet.
<xe:redirect>
	<xe:this.rules>
		<xe:redirectPhoneRule
			url="mobile.xsp" urlHash="document" disableRequestParams="false">
		</xe:redirectPhoneRule>
		<xe:redirectTabletRule
			url="mobile.xsp" urlHash="document" disableRequestParams="false">
		</xe:redirectTabletRule>
	</xe:this.rules>
</xe:redirect>