javascriptreactjswindow

How to open a new instance of the browser in javascript / Reactjs?


Is there any way in javascript / React to open a new instance of the browser ?

I know , for example, that window.open("https://www.w3schools.com"); will open a new tab , but what I am trying to achieve is to open a new tab in another instance of the browser , and show it in a smaller size with the original browser window sitting behind, in the background. I will leave a screen shot below for a better understanding of what I am trying to achive.

.


Solution

  • You can pass configuration arguments into Window.open MDN reference

    window.open(
      "https://example.com",
      "Name the window here",
      "",
    )
    

    You can customize the size, but that will cause it to be near the top left of the screen, and it doesn't seem like you can use percentages to center the new window, so you might be able to do that with complicated maths.

    window.open(
      "https://example.com",
      "Name the window here",
      "width=500,height=500,screenX=500,screenY=500",
    )
    

    Note: I can't make this a Stack Snippet that you can run, because Stack Snippets have popups disabled:

    enter image description here

    But if you copy and paste this code in the dev console, it will work