: Specifies the distance in pixels from the left side of the user's primary screen to the left edge of the new window.
If you want your popup to be a specific size (like a dialog box) rather than a full tab, you must define dimensions.
const windowObjectReference = window.open(url, target, windowFeatures); window.open features
function openOAuthPopup(url) const width = 500; const height = 600;
: Specifies the width of the content area (viewport) in pixels. The minimum allowable value in most modern browsers is 100 pixels. : Specifies the distance in pixels from the
Browsers block arbitrary execution of window.open() . To execute successfully, the method must be called within a short window of a direct user interaction, such as a click or touchend event listener. javascript
// Helpful features string const features = [ width=$width , height=$height , left=$left , top=$top , 'resizable=yes', 'scrollbars=yes', 'toolbar=yes', 'location=yes', 'menubar=yes', 'status=yes' ].join(','); The minimum allowable value in most modern browsers
When using window.open , keep these rules in mind: