2

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.

Benjamin Trent
  • 7,378
  • 3
  • 31
  • 41
Ruruboy
  • 626
  • 3
  • 12
  • 36
  • Did you try to omit the second parameter? Also see http://stackoverflow.com/questions/27119867/window-open-not-working-in-ie11 – aaronk6 Feb 19 '15 at 22:16
  • Possible duplicate of [JavaScript open in a new window, not tab](http://stackoverflow.com/questions/726761/javascript-open-in-a-new-window-not-tab) – Jonathan Lonowski Feb 19 '15 at 22:18
  • Can I ask why you want to override user preference and open a new window? – RaGe Apr 24 '15 at 17:08

2 Answers2

0

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)

AngularLover
  • 364
  • 1
  • 12
0

"_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".

ironarm
  • 446
  • 4
  • 11