Javascript popup window

By | June 17, 2010

We always face the problems with popup window in JavaScript using window. Open command either in Custom content or pages that we design. Sometimes the parent window goes blank or sometimes the popup window looses focus and goes behind.

Problem Definition:

Suppose I want to open in popup window. So ideally I will use below code to do the same in my client side script.‘‘,’PreviewWindow’,’height=600,width=800,status=yes,toolbar=no,menubar=no,location=no’)

What happens here is that javascript uses the same current window object to open new window due to which the parent window gets disturbed. To resolve this we can tweak the code as follows with some more javascript :-).


//Call the function to open popup window

//Script for window open
function OpenWindow(url)
var newwindow;,’name’,’height=400,width=200′);
if (window.focus)

Happy scripting 🙂 :-)..

If you find this content useful, Please drop us an email at