Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 384067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:20:40+00:00 2026-05-12T15:20:40+00:00

I’m looking for a way to check if a link exists on a certain

  • 0

I’m looking for a way to check if a link exists on a certain page. I know that this is possible with a ping, but I really don’t know how to do this.

What I have is a list of links to other webpages, they should have a backlink to my page also. I want to check this, when the backlink is there, a text should appear, something like “ok” and when the result is negative, something like “no backlink”

I know the urls of the pages where my link should appear, in case you need to know that.

Any help would be great!

I have found a piece of code wich I think could be used to serve my needs. I self don’t know how, but it would be great if anyone can help me with this.

This is the code:

<html>
  <head>
     <script language="javascript" type="text/javascript">
     <!--
        var ajax = new XMLHttpRequest();

        function pingSite() {
           ajax.onreadystatechange = stateChanged;
           ajax.open('GET', document.getElementById('siteToCheck').value, true);
           ajax.send(null);
        }

        function stateChanged() {
           if (ajax.readyState == 4) {
              if (ajax.status == 200) {
                 document.getElementById('statusLabel').innerHTML = "Success!";
              }
              else {
                 document.getElementById('statusLabel').innerHTML = "Failure!";
              }
           }
        }
     -->
     </script>
  </head>

  <body>
     Site To Check:<br />
     <input type="text" id="siteToCheck" /><input type="button"  onclick="javascript:pingSite()" />

     <p>
        <span id="statusLabel"></span>
     </p>
  </body>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:20:41+00:00Added an answer on May 12, 2026 at 3:20 pm

    You can’t natively use Javascript to parse external domains, I used a proxy page which sniffs the content and feeds it to the ajax callback.

    My solution basically grabs the source of the site to check and sees if a string, which can be your site link matches. I would assume this should be sufficient rather than trying to parse and look for anchors, but you can be as thorough as you want ( parse the whole thing as a DOM element and look for href attribute value ).

    Let me know if you run into any issues.

    <?php
        $query = isset($_POST['submitted']) ? true : false;
        if ( $query ) {
        $url = @file_get_contents( $_POST['site-url'] );
        if ( $url && strlen( $url ) > 0 ) {
            $checkFor = $_POST['check-for'];
            $match = preg_match( '/' . $checkFor . '/', $url );
            echo $match ? 'string (link) is found' : 'string not found';
        } else {
            echo 'could not connect to site..';
        }
        exit;
        }
    ?>
    <form action="" id="site-checker">
        <div class="field">
        <label for="site-url">Site to check:</label>
        <input id="site-url" name="site-url" value="http://jquery.com">
        </div>
        <div class="field">
        <label for="check-for">Check for:</label>
        <input id="check-for" name="check-for" value="docs.jquery.com">
        </div>
        <input type="hidden" name="submitted" value="true">
        <input type="submit">
    </form>
    
    <div id="result"></div>
    
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    <script>
        $('#site-checker').submit(function(e) {
        e.preventDefault();
        $.ajax({
            url:'check.php',
            type:'POST',
            data:$('#site-checker').serialize(),
            success:function(html) {
            $('#result').html( html );
            }
        });
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm looking for suggestions for debugging... If you view this site in Firefox or
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I have some data like this: 1 2 3 4 5 9 2 6

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.