You have to do that on server side e.g. with PHP
PHP(checkDomain.php):
<?php
$string = file_get_contents('http://www.shaarzh.com'); //Get external content
$reg = '/example.com/s'; //Search pattern
if(preg_match($reg, $string)){
$array = array('response' => 'true');
}else{
$array = array('response' => 'false');
}
echo json_encode( array('response'=>'false') ); //Response
?>
Now you can call the PHP-script with JavaScript.
JavaScript(jQuery):
$.ajax({
url: "checkDomain.php",
dataType: 'json',
success: function(data){
alert(data.response);
}
})
1
solved How to find my link in an external domain name [closed]