For more information... RTFM!
NAVIGATION
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

bounce

The [bounce] tag is designed to send an HTTP redirect (302 status code) to the browser to send it to another (possibly Interchange-parsed) page.

Summary

  • [bounce href if]

Parameter Description Default
href The full URI for a page to which the user's browser should be redirected. None
if Allow the redirection to be dependent on the outcome of a logical test. None
page Specify a local Interchange page name to bounce to, instead of using the href parameter along with a full URI. None
status Specify a different HTTP protocol status code. 302 moved

Description

The [bounce] tag is designed to send an HTTP redirect (HTTP protocol status code 302) to the browser to send it to another (possibly Interchange-parsed) page.  The "status" parameter can be used to specify a different HTTP protocol status code.

The Interchange tag parser will terminate at the point where the [bounce] is executed, and no further tags will be parsed.  Bear in mind that if you are inside a looping list, that list will run to completion and the [bounce] tag will not be seen until the loop is complete.

Warning

Warning

This tag is not available for use with embedded Perl due to the special processing required within Interchange's ICML tag parser.

Example of bouncing to a page on an external website:

[bounce href="http://www.example.com/index.html"]

Example of bouncing to another page on your Interchange-driven website:

[if !scratch real_user]
    [bounce href="[area violation]"]
[/if]
Note

Note

In the above example, the full URI is generated by the [area] tag.

Since the HTTP specification requires the URI to be absolute, the next example is invalid and might produce a browser warning, or worse:

[if value go_home]
    [bounce href="/"]
[/if]

The following is better, as it makes use of the [area] tag to generate a fully qualified URI for your Interchange-driven website's "index.html" page:

[if value go_home]
    [bounce href="[area index]"]
[/if]

The following is better still, as it does the same job without needing to make use of the [area] and [if] tags:

[bounce page="index" if="[value go_home]"]

Parameters

href

The full target URI for a page to which the user's browser should be redirected.

if

The "if" parameter allows the redirection to be dependent on the outcome of a logical test.  This test might be a simple as the presence or absence of a value, or as complex as multiple lines of Perl within a [calc] or [perl] construct.  The bounce will only occur if the parameter resolves to a true value.

For example, if there are more than two items in the cart then the following will redirect the visitor to the "basket" page:

[bounce href="[area ord/basket]" if="[calc][nitems] > 2[/calc]"]

page

You may have noticed that most of the above examples make use of the "href" parameter and the [area] tag.  You can avoid the expense of calling the [area] tag by using the "page" parameter to specify a page name instead.

For example, the following two [bounce] calls are exactly equivalent to one another:

  • [bounce href="[area foo]"]
  • [bounce page="foo"]

If you need to encode arguments into the URI, you you want to bounce to a secure internal page then you will need to use the [area] tag, along with the "href" parameter, rather than the page parameter.


Note

Note

A "mv_session_id" parameter will always be added to the generated URI, unless the "mv_no_session_id" scratchpad variable is set true and a "MV_SESSION_ID" session cookie was provided with the request for the current page.

Warning

Warning

Don't confuse the similarly-named "mv_no_session" and "mv_no_session_id" scratchpad variables.  Setting the "mv_no_session" variable true will force this tag to drop the "mv_session_id" parameter from the URI in all cases, whereas setting the "mv_no_session_id" variable true will only cause the "mv_session_id" parameter to be dropped from the URI if a "MV_SESSION_ID" session cookie was provided with the request for the current page.

status

Interchange, by default, forces a page redirect by returning a temporary "302 moved" status code, along with the new target URI, to the visitor's browser.

You can use the "status" parameter to specify a different HTTP return code, such as "301 Permanent Redirect".  See the list of standard HTTP/1.1 status code definitions Link to an external page, as defined and published by the W3C Link to an external page.  For example:

[bounce page="newpage" status="301 Permanent Redirect"]

Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Saturday 15 September 2007 at 10:47 AM (EDT)
Home  |  Legal nonsense  |  Privacy policy  |  Donations  |  Contact us