Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * 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 = width || 450,
- _height = height || 300,
- left = (screen.width / 2) - (_width / 2),
- right = (screen.height / 2) - (_height / 2);
- let options = [
- 'width=' + _width,
- 'height=' + _height,
- 'left=' + left,
- 'top=' + right,
- '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();
- }
- };
- export default PopUpWindow;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement