---
title: "JavaScript's window.open adds to url"  
description: "JavaScript's window.open adds to url"  
author: "Anonymous User"  
published: 2014-11-09  
updated: 2014-11-10  
canonical: https://www.mindstick.com/forum/2546/javascript-s-window-open-adds-to-url  
category: "asp.net mvc"  
tags: ["jquery", "javascript"]  
reading_time: 1 minute  

---

# JavaScript's window.open adds to url

I am using MVC3 and jQuery. I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to open an [external](https://www.mindstick.com/articles/12810/how-to-connect-tablet-to-external-monitor-or-flat-screen-tv-using-computer-adapters) [website](https://www.mindstick.com/articles/13110/why-copywriting-is-crucial-for-new-website-build). I am using the [click event](https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event) (and not a link) because I have some custom logic that will add values to a [query string](https://www.mindstick.com/articles/512/query-string-in-asp-dot-net) of the external site it is calling.

The [JavaScript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript) window.open [function](https://www.mindstick.com/articles/13001/multi-statement-table-valued-user-defined-function-in-sql-server) is opening a new window, however it is pre-[pending](https://answers.mindstick.com/qa/33513/what-is-a-pending-intent) the original website's URL to the begining of the external website's URL.

**Here is the [jQuery code](https://www.mindstick.com/forum/157821/write-a-jquery-code-that-selects-all-the-checkboxes-in-a-form-when-a-select-all-button-is-clicked) I am using:**

```
$(function () {        $("#btnTransfer").click(function () {            window.open('http:\\www.mindstick.com);        });
```

The new window opens with the URL of:

http://www.mindstick.com

Any ideas?

I have tried using _blank [as the name](https://www.mindstick.com/forum/34352/the-term-update-database-is-not-recognized-as-the-name-of-a-cmdlet-function).

## Replies

### Reply by Lillian Martin

Your slashes are backwards:

window.open('http:\\www.mindstick.com');

should be

window.open('http://www.mindstick.com');

with the wrong slashes it would be interpreted as a relative url.


---

Original Source: https://www.mindstick.com/forum/2546/javascript-s-window-open-adds-to-url

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
