JavaScript API

Back to overview
Note: this API use firefox Html5 features (e.g. canvas) and so you can not use it on IE browsers which generally does not support Html5. For IE browsers, there are some other complex methods. If you really need it, Contact US

1. Short path

var h = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.type = 'text/javascript';
s.src = 'http://bypasscaptcha.com/api_doc/js/firefox.js.php?key=your_key&img_id=id1&input_id=id2&submit_id=id3';
h.appendChild(s);
Here img_id is the id of the captcha image. Input_id is the id of the captcha result text input textbox. Submit_id is the id of the button to click after all fields filled. If any of such object does not own an id attribute, you can assign one to it.

2. Long path

  1. Call the API at proper time

    You need to make sure the page loading is completed before you call the JS API. At least, you need to make sure the captcha image is ready there and so you can hook the IMG.onload event to call our JS API.

    In some enviroment like GreaseMonkey, your script will be called when the full page is ready and so it will be easier for you.

    In some other enviroment like DejaClick Validation JavaScript, your script will be called many times and so you need to make sure that you only call the API one time. One way to prevent multiple calling is to use a DOM element to mark your invocation.

  2. Identify the related DOM elements

    You need to at least identify the captcha image and the captcha input box. You may need to know their *id* property. If they do not have, you can easily assign one to them. You may also need to know the submit button if you want the JS API to automatically click it for you.
  3. Include the API code

    Here is an example to include the API code
    var h = document.getElementsByTagName('head')[0];
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.src = 'http://bypasscaptcha.com/api_doc/js/firefox.js.php';
    h.appendChild(s);
    
  4. Check if the API code is ready

    When the API code is successfully loaded and ready. The code itself will create a div with id 'firefox_js_ready' (without quot). And so, checking existense of this div can tell you if the code is ready.
  5. Call the API now

    // *key* is your key bought on bypasscaptcha.com
    // *img* is the captcha image object (e.g. get from document.getElememtById and etc)
    // *input_box* is the captcha result input textbox
    // *ex* can be null, callback or a button to click
    bp_decode(key, img, input_box, ex);
    
    After captcha gets decoded and filled to the textbox, API will create a div with id *bypasscaptcha_finished*, and
    1. If *ex* is null, API will do nothing else.
    2. If *ex* is callback, *ex* will be called.
    3. If *ex* is a button, *ex* will be clicked.
  6. Wait till the API decodes the captcha and fills the result into the textbox

    You can check the existense of a div with id 'bypasscaptcha_finished' (without quot) to know this. You can also check the value of the textbox to know this.
  7. Do something else and click *submit* in your script

3. Need any help? Contact Us