Dialog close button override

Dialog close button override

Hey all,

I have couple of pages with links that have data-rel="dialog" which gives the nice pop up effect and formats the page to look like a hovering dialog, I now need to overwrite the url that is put into the automatically generated cross button on the top left corner that is used to dismiss the dialog. I tried adding a back button but it adds it to the right side of the dialog and the cross is still there.

The reason I'm looking to do this is that we are holding our own history on server side and want all clicks to back button to go to certain url and this works fine by overriding the default back button on normal pages but doesn't seem to work on dialogs.