Skip to content

Instantly share code, notes, and snippets.

@chrisjhoughton
Created March 15, 2014 21:37
Show Gist options
  • Save chrisjhoughton/9574275 to your computer and use it in GitHub Desktop.
Save chrisjhoughton/9574275 to your computer and use it in GitHub Desktop.
Open a JavaScript popup window in the center of the screen. Kudos to http://stackoverflow.com/questions/4068373/center-a-popup-window-on-screen
var popupwindow = function (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, copyhistory=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