SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2002
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can JavaScript resolves the response code of a url?

    Some times the PHP server that hosting my site become down, while, the server still executes the html and JavaScript. I am looking for a method that resolves the response code of a page (e.g.: 404, 500) and redirect the user agent to another url. Can JavaScript help me in this case?
    Last edited by lensano; Jan 19, 2003 at 07:22.

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you able to edit the 404 etc. response pages on your server? Once the "page not found" error has appeared, it's too late to do anything with Javascript on your other pages as they aren't loaded (unless you're using frames).

    If you can have a custom 404 appear, then you can put redirect code in the page.
    From the English nation to a US location.

  3. #3
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    You can search for an image.......

    Don't know if it helps but you can use onError to see in a picture loads.

    so if you know that a picture should exist at the URL you could use....

    Code:
    <img src="PicAtURL.gif" onError="alert('no pic')">
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •