Creating a popup

I was creating a confluence macro which can be helpful in creating a popup window on clicking it. But when I try to launch a new window, the code normally works fine but it is not possible when I use that to create macro and launch it using confluence. I would like to create a chat window on side of my confluence page and that is what I am looking to create as a macro. Can anyone help me out with this?