How to find a modal opener from javascript?


I have a page that opens a modal dialog. After the operations done on dialog I want to refresh the opener page. But when I open the popup by using "openDialog" I cannot access to the opener by using window.opener on popup page. It appears "undefined" when I wanted to access. (I dont want to use "popup" method in this case. I want it to be a dialog by the way. using "popup" is my second plan.)

What is the best practice to get rid off this issue?

Modifying parent data from modal dialog

Refresh parent window from modal child window