Back Botton Script Not Working - Dialog Box

Back Botton Script Not Working - Dialog Box

I have a page that has an openurl(#) pop up script in it.  This allows me to open a form without navigating away from the current page.  the problem I am now having is that when I hit the back button it loads the dialog pop up box instead of taking me to the previous page.  Is there any way to fix this? I have tried the following:

#Script:page.back
#Script:page.parent.back

But both of them reload the dialog box instead of loading the previous page. 

Again, if i have opened any dialog boxes it will reload those dialog boxes instead of taking me back to the previous page. I need it to take me back to the previous page - NOT reload the dialog box. 

Please help.  Thank you.