There really does have to be a confirm message box which stops execution until a response is made! Some applications simply can not proceed otherwise. In some circumstances there simply is no workaround.
Yep, it will be a better solution, but this is a limitation of javascript - there is no way to pause the execution flow. The callback solution is the only possible way.