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.
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.
Share Improve this question edited Feb 19, 2015 at 22:16 Benjamin Trent 7,6063 gold badges33 silver badges42 bronze badges asked Feb 19, 2015 at 22:13 RuruboyRuruboy 6623 gold badges15 silver badges36 bronze badges 3- Did you try to omit the second parameter? Also see stackoverflow./questions/27119867/… – aaronk6 Commented Feb 19, 2015 at 22:16
- Possible duplicate of JavaScript open in a new window, not tab – Jonathan Lonowski Commented Feb 19, 2015 at 22:18
- Can I ask why you want to override user preference and open a new window? – RaGe Commented Apr 24, 2015 at 17:08
2 Answers
Reset to default 1The _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)
"_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".
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745475269a4629319.html
评论列表(0条)