I am trying to open new window from a lightning component using window.open
I want to center this new window in the middle of the screen.
for this I am using this code :
var myWidth= 600; var myHeight=window.innerHeight; var left = (screen.width - myWidth )/ 2; var top = (screen.height - myHeight) ; window.open('https://salesforce.stackexchange.com/','_blank','height='+myHeight+',width='+myWidth+',left='+left);
This work well when I open the window from my laptop screen but not at all when I open it from an other monitor.
what can I do to make sure this new window will always appear in the middle of the screen , no matter the size of the screen?