Ruruboy
Ruruboy

Reputation: 662

window.open opening new tab instead of new window in IE 11

I have an ASP.NET application which uses window.open. It opens a tab instead of a new window. This happens in IE 11. In IE 8 it works fine.

Since we are moving to IE 11 we want this to work on IE 11 too.

var url = "reportViewer.aspx?reportname=" + $("#hfReportName").val() + "&schoolDistrict=" + district
            window.open(url, "_blank");

I have done my research and here is what I found.

I am not sure if that is the right way of doing this. I want to do this through code. Any idea how I can do this. Let me know. thanks in advance.

Upvotes: 2

Views: 10758

Answers (2)

ironarm
ironarm

Reputation: 472

"_blank" is the default for window.open. You don't need it. Your link is opening in a new tab because of a browser setting, not code. Go to Internet Options, General, Tabs. There is a section, "When a pop-up is encountered". You would have to change this to "always open pop-ups in a new window".

Upvotes: 0

AngularLover
AngularLover

Reputation: 364

The _blank is for open in new tab. Just remove the second parameter of window.open, which is optional, it will work fine.

Use it like this : window.open(url)

Upvotes: 0

Related Questions