I met this problem too.
You can use window.location make browser visit new page, but current page is not recorded in the browser history (at least with google chrome).
So I agree with SMathew that the new event should be triggered. But due to some security reason, the click event on anchors triggered by jQuery do not make browser visit new page. Finally I found the following code works.
$("a.confirm").on('click', function(e) {
if (!$(this).data('confirmed')) {
e.preventDefault();
var a = this;
bootbox.confirm("Are you sure?", "No", "Yes", function(result) {
if(result) {
$(a).data('confirmed', 1);
if (document.createEvent) {
var evObj = document.createEvent('MouseEvents');
evObj.initEvent('click', true, true);
a.dispatchEvent(evObj);
}
else if (document.createEventObject) {
a.fireEvent('onclick');
}
}
});
}
});
I just test above code in google chrome, and I found fire event code from https://getsatisfaction.com/issuu/topics/opening_the_issuu_smartlook_viewer_with_my_flash_website?utm_content=topic_link&utm_medium=email&utm_source=reply_notification
MORE
I found this post https://stackoverflow.com/a/18132076/1194307 , and jQuery.simulate can be used to solve this problem. My final code looks like:
$("[data-toggle=confirm]").on('click', function(e) {
var a = $(this);
if (!a.data('confirmed')) {
e.preventDefault();
var question = a.data('question');
if (!question) question = 'Are you sure?';
var yes = a.data('yes');
if (!yes) yes = 'Yes';
var no = a.data('no');
if (!no) no = 'No';
bootbox.confirm(question, no, yes, function(result) {
if(result) {
a.data('confirmed', 1).simulate('click');
}
});
}
});
It works on anchors and form buttons.