document.addEventListener("backbutton

JavaScript
document.addEventListener("backbutton", yourCallbackFunction, false);

Source

Also in JavaScript: