...gets fired when someone presses on it...
The code you quoted doesn't generate or specify anything that can be 'pressed'!
Otherwise, the code snippet that you quoted is correct. However, there are several possibilities why it might not work as expected:
1. the code is never reached, due to an earlier coding error
2. the code is not executed because a reference to cordova.js is missing or because you didn't wait for the deviceready event to fire
3. You don't have the inappbrowser plugin referenced in config.xml or you haven't installed the plugin (if working on CLI).
It must be the device ready event as i saw that error. it only happened since the latest update of ios i even tried it back to an older version where i knew it all worked.
Either that or there was some plugin update thats breaking everything.