Clicking on the button will close your viewcontroller, which shows the modal.
I think you do not want this to happen, and just close the javascript modal.
Yes, you will need to change your own code.
On native backbutton click, if your modal is open: close the modal else: do default backbutton action.
The following is a detailed explanation.
On native backbutton click
I assumed that you know how to communicate between javascript and native, if you do not look at http://www.smashingmagazine.com/2013/10/best-of-both-worlds-mixing-html5-native-code/
source share