Finding out if a HTML page in a foreign domain exists before youallow navigation to it

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stevo

    Finding out if a HTML page in a foreign domain exists before youallow navigation to it

    Does anyone know of a way to check if a html file exists in a different
    domain so that you can know in advance whether going there would result
    in a 404? I believe Ajax would allow that in the same domain, but
    wouldn't in a different domain. The page I might go to is totally out of
    my control, so I can't do anything that side. I'm expecting this won't
    be possible, but figured I'd ask.
  • Randy Webb

    #2
    Re: Finding out if a HTML page in a foreign domain exists beforeyou allow navigation to it

    Stevo said the following on 2/22/2008 11:37 AM:
    Does anyone know of a way to check if a html file exists in a different
    domain so that you can know in advance whether going there would result
    in a 404? I believe Ajax would allow that in the same domain, but
    wouldn't in a different domain. The page I might go to is totally out of
    my control, so I can't do anything that side. I'm expecting this won't
    be possible, but figured I'd ask.
    No. Not on an internet site anyway. I could dream up a way to do it
    running locally though.

    --
    Randy
    Chance Favors The Prepared Mind
    comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
    Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

    Comment

    • Stevo

      #3
      Re: Finding out if a HTML page in a foreign domain exists beforeyou allow navigation to it

      Randy Webb wrote:
      Stevo said the following on 2/22/2008 11:37 AM:
      >Does anyone know of a way to check if a html file exists in a
      >different domain so that you can know in advance whether going there
      >would result in a 404? I believe Ajax would allow that in the same
      >domain, but wouldn't in a different domain. The page I might go to is
      >totally out of my control, so I can't do anything that side. I'm
      >expecting this won't be possible, but figured I'd ask.
      >
      No. Not on an internet site anyway. I could dream up a way to do it
      running locally though.
      Thanks, figured as much.

      Comment

      • John Nagle

        #4
        Re: Finding out if a HTML page in a foreign domain exists beforeyou allow navigation to it

        Stevo wrote:
        Does anyone know of a way to check if a html file exists in a different
        domain so that you can know in advance whether going there would result
        in a 404? I believe Ajax would allow that in the same domain, but
        wouldn't in a different domain. The page I might go to is totally out of
        my control, so I can't do anything that side. I'm expecting this won't
        be possible, but figured I'd ask.
        If it's a page on a server you control, you could have a link-checking
        process on the server which checked your pages and disabled broken links.
        That's entirely on the server side.

        If it's on a client you control, you could write a Greasemonkey script
        to check links on each page as it is loaded. But the overhead would be
        high.

        What are you trying to do?

        John Nagle
        SiteTruth

        Comment

        • adamcbrz@gmail.com

          #5
          Re: Finding out if a HTML page in a foreign domain exists before youallow navigation to it

          On Feb 23, 10:32 pm, John Nagle <na...@animats. comwrote:
          Stevo wrote:
          Does anyone know of a way to check if a html file exists in a different
          domain so that you can know in advance whether going there would result
          in a 404? I believe Ajax would allow that in the same domain, but
          wouldn't in a different domain. The page I might go to is totally out of
          my control, so I can't do anything that side. I'm expecting this won't
          be possible, but figured I'd ask.
          >
              If it's a page on a server you control, you could have a link-checking
          process on the server which checked your pages and disabled broken links.
          That's entirely on the server side.
          >
              If it's on a client you control, you could write a Greasemonkey script
          to check links on each page as it is loaded.  But the overhead would be
          high.
          >
              What are you trying to do?
          >
                                                  John Nagle
                                                  SiteTruth
          this can be accoplished with Ajax, PHP, & Curl. Curl is an extention
          for php. With it you can retieve alot a information on a site/page
          including the status.

          Hope that helps!
          Adam

          Comment

          • Stevo

            #6
            Re: Finding out if a HTML page in a foreign domain exists beforeyou allow navigation to it

            John Nagle wrote:
            Stevo wrote:
            >The page I might go to is totally out of my control
            If it's a page on a server you control, you could have a link-checking
            process on the server which checked your pages and disabled broken links.
            That's entirely on the server side.
            Sadly it's not :(
            If it's on a client you control, you could write a Greasemonkey script
            to check links on each page as it is loaded. But the overhead would be
            high.
            >
            What are you trying to do?
            I was asked if I could provide some JavaScript that could check whether
            a regular link to a different site would result in a 404. I said that I
            was 99% sure it couldn't be done but I'd ask around.

            Comment

            • Stevo

              #7
              Re: Finding out if a HTML page in a foreign domain exists beforeyou allow navigation to it

              adamcbrz@gmail. com wrote:
              On Feb 23, 10:32 pm, John Nagle <na...@animats. comwrote:
              >Stevo wrote:
              >>Does anyone know of a way to check if a html file exists in a different
              >>domain so that you can know in advance whether going there would result
              >>in a 404? I believe Ajax would allow that in the same domain, but
              >>wouldn't in a different domain. The page I might go to is totally out of
              >>my control, so I can't do anything that side. I'm expecting this won't
              >>be possible, but figured I'd ask.
              this can be accoplished with Ajax, PHP, & Curl. Curl is an extention
              for php. With it you can retieve alot a information on a site/page
              including the status.
              Hope that helps!
              Adam
              Unfortunately I would only have Javascript available for this.

              Comment

              Working...