Skip to content

Instantly share code, notes, and snippets.

@janbaykara
Created March 14, 2015 20:05
Show Gist options
  • Save janbaykara/ceb2f0162d55820c1e9e to your computer and use it in GitHub Desktop.
Save janbaykara/ceb2f0162d55820c1e9e to your computer and use it in GitHub Desktop.
Little function create a plain, centered popup window.
/*
// Usage
var w = popupWindow("","_blank",400,600);
w.document.write(html);
var retrieveData = w.opener.data;
w.close();
*/
function popupWindow(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width='+w+', height='+h+', top='+top+', left='+left);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment