Open window

Simple javascript source code to open popup windows

function open_window(url){
 
    var wparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,';
        wparams += 'scrollbars=0,resizable=0,width=280,height=150';
 
    var window = window.open(url, 'window_name', wparams);
    window.focus();
}
 
 
function create_window(content){
 
    var wparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,';
        wparams += 'scrollbars=0,resizable=0,width=280,height=150';
 
    var window = window.open('', 'window_name', wparams);
 
    window.document.open();
    with(window.document){
        write(content);
        write("<br/>");
        write("<a href=\"javascript:self.close();\">Close window</a>");
    }
    window.document.close();
 
    window.focus();
}
Snippet Details



open_window('http://www.jonasjohn.de/') or create_window('<b>Test</b>');

Sorry folks, comments have been deactivated for now due to the large amount of spam.

Please try to post your questions or problems on a related programming board, a suitable mailing list, a programming chat-room,
or use a QA website like stackoverflow because I'm usually too busy to answer any mails related
to my code snippets. Therefore please just mail me if you found a serious bug... Thank you!


Older comments:

Pedro November 20, 2009 at 22:37
tnx for good expanation