Entries Tagged 'SEO and AJAX' ↓

Simple AJAX call to Hide a Form from bots and Search Engines

Tired of the “Spambots” that crawl around the internet and find email adresses and forms to send and submit spam to. This can help hide your forms from bots. This is also a way to hide “affiliate forms” from the likes of Google, Yahoo and MSN. The current trend is to devalue affiliate sites that are there just to send traffic to another site. By inserting your left or right column list of affiliate links or a submission form that sends data to the affiliated company. This will help reduce the detection of such links and forms.

This is really a simplistic approach and if you are really trying to hide a number of links or forms, there should be more validation and care to not display the forms and links to Google bots or Google employees. Renaming the script file and the name of the script to more of a general function name may also help from automated detection.

You need the XHConn.js script to use the code below. Download XHConn here.

Do to the browser caching ajax pages called, I added a random number to the XHConn xmlhttp.open call. This forces a “unique” page call to prevent caching and not displaying updated data. Changes are highlighted.
<!--link XHConn.js in <head> of HTML -->
<script type="text/javascript" src="XHConn.js" ></script>
<!--script can go most anywhere in the HTML code, but is more proper to put in the <head> or top of HTML in the Body -->
<script type="text/javascript" >
window.onload = displayForm
// Requires Javascript and compliant browser on client for Form to be displayed.
function displayForm()
{
// Simple AJAX Form Insert to Hide Form from Spam Bots and Search Engines
var myConn = new XHConn();
if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");
var fnWhenDone = function (oXML)
{
document.getElementById("FormHolder").innerHTML = oXML.responseText;
// ID of <div> or other HTML element to hold the form.
};
myConn.connect("/formpage.php", "GET", "" , fnWhenDone);
// formpage.php should hold just HTML to display the form.
return false;
}
</script>

Real Users that don’t have javascript enabled will also not see the form as Javascript is required. If the page you are calling in the AJAX call is .php, .asp, .cfm or other server side scripting language you can take further actions to protect the page from being displayed to the bots or provide an alternate form that does point to your site.

Another option would be having a “fake” form that is in the original pages HTML code and then replace that form with the new one. When looking at the “source code” the user get the originally loaded HTML not the dynamically updated code.

AJAX for Search Engine Optimization (SEO)

This is a topic I am looking into.  I feel that with search engines focusing on links on your home page or other landing pages and if you don’t want to pass value or rather just “hide” affiliate links from Google, Yahoo, or MSN you could load that section of links through AJAX.

AJAX calls are loaded and placed on the page after the page is initially loaded, but it is usually very quick depending on the data being loaded and should be nearly unnoticeable  from the users.  This can also be used to make it harder for form submitting bots that read your code and then hit that page directly with their spam information.

Look for more shortly on this topic and I hope to have a few examples of ajax code.