AMPscript
Redirect
RemoveCookie
RemoveResponseHeader
SetCookie
SetResponseHeader
Write
Validate Your Server-Side JavaScript using WSProxy
Redirect the browser to a specified address and terminate the processing of the current web content.
1Redirect(1,2)| Ordinal | Type | Description |
|---|---|---|
1 | String | Required. The address to direct the user’s browser to. |
2 | Boolean | Indicates whether the redirect is temporary or permanent. A value of true results in an HTTP 301 Moved Permanently redirect. A value of false results in a 302 Found redirect. The default value is false. |
1<script runat="server">Platform.Response.Redirect("http://www.example.com");</script>If you include a try/catch block in your SSJS code, and the try block contains a redirect, it triggers the catch block. In this code example, the try block contains a redirect to https://salesforce.com. However, the result is a redirection to https://example.com.
1<script runat="server">
2 try {
3 Platform.Response.Redirect("https://salesforce.com");
4 } catch(e) {
5 Platform.Response.Redirect("https://example.com");
6 }
7</script>