/** * Opens a new browser window * @param {String} url The url of the window to open * @param {String} name The name of this window * @param {Number} width Window width * @param {Number} height Window height */ const popUpWindow = (url, name, width, height)=> { // Center the window let _width = Math.min(width || 640, screen.availWidth), _height = Math.min(height || 480, screen.availHeight), left = (screen.width / 2) - (_width / 2), top = (screen.height / 2) - (_height / 2); let options = [ 'width=' + _width, 'height=' + _height, 'left=' + left, 'top=' + top, 'resizable=0', 'menubar=0', 'centerscreen=1', 'location=0', 'scrollbars=0', 'toolbar=0', 'status=0' ]; const newwindow = window.open(url, name, options.join(',')); if (window.focus) { newwindow.focus(); } return newwindow; }; export default popUpWindow;