TeleportJobs Webmaster Tools logo  beta!
(we welcome your feedback)
   
TeleportJobs home Webmaster Tools faq register login 
 
     

JavaScript JSON method of human verification captcha

OK. I have to admit why I am using JSON technology versus AJAX to validate our captcha. I was wrong to try and use AJAX to make a call to our servers because this method violates most browsers default security settings and the browser won't post to a domain other than the domain that the client browser originally called. This is typically called cross-domain violation. The AJAX method can still be used if you set up a proxy server on your domain but it's a lot of work. A simpler method is to use a varied form of JSON to send parameters in the source url for a javascript file.

There are plenty of documents available on the web that explain how JSON technology works so I won't get into the complete details and go straight to how you can verify our captcha using this method.

I left the original page on the AJAX method intact in case anyone wants to try and use this method with a proxy server. Your on your own if you want to try and develop the proxy server.

Implemetation:
  1. Make sure that your web host allows you to have Server Side Includes or SSI. Basically this allows you to save a page as .SHTML vs .HTM or .HTML Also remember to save your page with the .SHTML extension.
  2. Make sure you know YOUR webmaster ID.
  3. Copy the following JavaScript into the <head></head> section of your SHTML page. Preferably right before the closing tag </head>
  4. Make sure that you change YOUR_WMT_ID to your actual webmaster ID that was assigned to you when you signed up.
  5. Make sure that the "id" element of your form is set to the same name as "FORMID" above.
  6. "YOUR_SUBMIT_PAGE" above should be the url of the page that you want to submit the form contents to if the captcha text is valid.
  7. Place the captcha image, captcha input box, and div tag directly above the submit button for your form. You can copy and paste the code below directly above the submit button:



    Make sure to replace YOUR_WMT_ID with the 8 character webmaster ID assigned to you when you registered.

  8. Set the "action" element within the <form> tag to:
    action="JavaScript:ValidateCaptcha(document.getElementById('captcha').value);"
  9. Here is an outline of the page format:

    <html>
    <head>
    <script language="javascript" type="text/javascript">PLACE JavaScript CODE HERE</script>
    </head>
    <body>
    <form name="" id="FORMID" method="POST" action="JavaScript:ValidateCaptcha(document.getElementById('captcha').value);">
    <img src="URL OF CAPTCHA IMAGE">
    <input type="text" name="captcha" id="captcha">
    <div id="CaptchaMessage"></div>
    <input type="submit" name="Submit1" value="submit">
    </form>
    </body>
    <html>

  10. I think that this is it. Let me know if this works and if you have any questions on how to implement this by contacting me here.
     
terms of use privacy policy     copyright TeleportJobs 2004 - 2007