Javascript to open new window

A classic!

To open a new window in JavaScript, you can use the window.open() method. Here's a basic example:

window.open("https://www.example.com", "_blank");

This will open a new window with the URL https://www.example.com and set the target to _blank, which means the link will open in a new tab or window.

Here are some additional options you can pass to window.open():

Here's an example that opens a new window with specific features:

window.open("https://www.example.com", "_blank", "width=800,height=600,scrollbars,resizable");

This will open a new window with a width of 800 pixels, a height of 600 pixels, scrollbars, and the ability to be resized.

Note that some browsers may block pop-ups or have restrictions on opening new windows, so be sure to test your code in different browsers to ensure it works as expected.