Daniel Borden wrote:
Big hello to my fellow programmers - I'm new to javascript and PHP and I am
wondering if there is a method or function to capture a 404 error in the
event a particular html file cannot be found. I want to redirect that error
to another page or design the code to send me an email telling me what page
was selected and not found. In other languages I can trap such an error and
respond to it.
Thanks,
Dan
This would not be a client-side JavaScript or a server-JavaScript or PHP issue
(well, not directly).
Configure your web server to go to a custom 404 response page, then that 404
response page can execute any server-side code of your choice to do whatever
you want it to do. How you do this is server dependant, in apache, you use the
ErrorDocument directive: <url:
http://httpd.apache.org/docs/mod/cor...#errordocument />. ErrorDocument can
be specified site wide, or just for a specific directory, it can also be
changed dynamically by adding it to/changing it in a .htaccess file in a
directory.
--
| Grant Wagner <gw*****@agricoreunited.com>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
*
http://www.mozilla.org/docs/web-deve...upgrade_2.html