![]() |
| Frontier Tutorials / Writing an ObjectNotFoundHandler |
You want to add new capabilities to your MainResponder dynamic website. For example, you want to be able to respond to requests for JavaScript source files (xxx.js) or some other type of data that MainResponder doesn't understand, and that doesn't readily fit into the website hierarchy. Or perhaps you want to serve up a large amount of data as individual pages, but you don't particularly want to create separate entries for all the data. Or perhaps you simply want to redirect unrecognized URLs to a "File-not-found" page with a search form.
In a site served via Frontier's MainResponder dynamic website framework, you can do any or all of the above. You create a single entry called an objectNotFoundHandler; it can return any data you like in response to any URL within your website.
You've seen the default result of requesting an unknown URL from a MainResponder site:
|
|---|
Wouldn't you rather see:
|
|---|
By the end of this tutorial, you will be able to create an ObjectNotFound handler to return anything you want in response to a request for an unknown URL, including a more user-friendly Page-Not-Found page like the example above.
This tutorial is intended for experienced Frontier scripters. It requires familiarity with Frontier's UserTalk scripting language and with the MainResponder dynamic website framework.
Before continuing this tutorial, you should read and be familiar with the following mainResponder articles from Dr. Matt:
The Walk: How mainResponder resolves a requested URL and attempts to find the corresponding page.
Script Objects: How mainResponder serves script objects as website pages.
Redirection: How to do redirection in mainResponder--including avoiding common unexpected behavior.
| Author: | Samuel Reynolds |
|---|---|
| Email: | sam@spinwardstars.com |
| First Published: | 2000/01/19 |
| Last Revision: | 2002/07/29 |
| Keywords: | tutorial, mainResponder, 404, 404-NOT FOUND, objectNotFoundHandler |
| Level of Difficulty: | Moderate |
|
|---|