daily pastebin goal
75%
SHARE
TWEET

Untitled

a guest Oct 17th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function PopupCenter(url, title, w, h) {
  2.             // Fixes dual-screen position                         Most browsers      Firefox
  3.             var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : window.screenX;
  4.             var dualScreenTop = window.screenTop != undefined ? window.screenTop : window.screenY;
  5.  
  6.             var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
  7.             var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
  8.  
  9.             var left = ((width / 2) - (w / 2)) + dualScreenLeft;
  10.             var top = ((height / 2) - (h / 2)) + dualScreenTop;
  11.             var newWindow = window.open(url, title, 'scrollbars=yes, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
  12.  
  13.             // Puts focus on the newWindow
  14.             if (window.focus) {
  15.                 newWindow.focus();
  16. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top