---
title: "how we open a new window by java script?"  
description: "how we open a new window by java script?"  
author: "Amit Singh"  
published: 2010-10-16  
updated: 2023-05-17  
canonical: https://www.mindstick.com/interview/37/how-we-open-a-new-window-by-java-script  
category: "javascript"  
tags: ["javascript"]  
reading_time: 2 minutes  

---

# how we open a new window by java script?

we open new window in javascript by window.open() function Syntax window.open("page name","title name",status=""); here status contain toolbar stausbar menubar etc.

## Answers

### Answer by Aryan Kumar

To open a new window using JavaScript, you can use the **window.open()** method. This method creates a new browser window or tab, depending on the user's browser settings. Here's an example:

```javascript
// Open a new window with a specific URL
window.open('https://www.example.com');
// Open a new window with a specific URL and custom window features
window.open('https://www.example.com', 'MyWindow', 'width=500,height=400');
// Open a new window with a specific URL and additional options
window.open('https://www.example.com', '_blank', 'noopener,noreferrer');
```

In the above examples:

1. The first line opens a new window or tab with the specified URL (**https://www.example.com**).
2. The second line opens a new window with a specific URL and custom window features. The second argument (**MyWindow**) is the name of the window, which can be used as a target for links or to reference the window later. The third argument (**width=500,height=400**) specifies the width and height of the new window in pixels.
3. The third line opens a new window with a specific URL and additional options. The second argument (**'_blank'**) indicates that the new window should open in a new tab (if supported by the browser). The third argument (**'noopener,noreferrer'**) sets some security-related attributes to prevent the new window from having access to the opening window's **window.opener** object.

Note that the browser may override the provided window features (such as width and height) based on user preferences and security settings. Additionally, some browsers may block the **window.open()** method from opening new windows or tabs due to popup blockers or security settings.

It's important to use this functionality responsibly and avoid intrusive or unwanted popups that may disrupt the user experience.

### Answer by Amit Singh

we open new window in javascript by window.open() function Syntax window.open("page name","title name",status=""); here status contain toolbar stausbar menubar etc.


---

Original Source: https://www.mindstick.com/interview/37/how-we-open-a-new-window-by-java-script

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
