redirect()
NES2+Syntax
redirect(URL)
Description
The redirect function is a top-level function that is not associated with any core object. This function is used to redirect the requesting browser to the URL it was passed as a parameter.
Note
Use the addClient function to preserve client object properties and their values.
Example
Listing 8.101 checks to see if the browser asking for the page is Internet Explorer. The redirect function is then used to redirect the browser accordingly.
Listing 8.101 Using the redirect Function to Redirect a User's Browser
<SERVER> // Check to see if the browser is Internet Explorer if(request.agent.indexOf('MSIE') != -1){ redirect(addClient("/iepages/index.html")); // Redirect to another page if it is not ... |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.