1
votes

I have a new window opened via window.open method and in that window in content I have a link with "target=_blank".

When clicked the link opens new tab in parent window instead of the one that content was in. I also noticed that for that window (created with window.open) the Ctrl+T shortcut (to open blank tab, Firefox) does not work.

I checked window.open specs and I didn't find any option that would allow this behavior.

var a = window.open("http://www.google.pl", 
"Test",
"width=640,height=480,scrollbars=yes,toolbar=yes,menubar=no,location=no,resizable=yes"); 
a.focus();

Setting toolbar=yes makes it work in Firefox. Any idea how to make it work in chrome?

1
There's generally no way to control this from page code; it's ultimately a user-controlled behavior. - Pointy
What do you mean? How user can controll where _blank will be opened? - mrMike
They can control it via browser settings ("Always open new windows in browser tabs" for example). - Pointy
The one you mentioned is not related (window correctly opens). Are there any related? - mrMike
Again, ultimately the user is in control, both for the behavior of window.open() and for windows implied by target attributes. You can find ways to make things work sometimes, in some browsers, but there are no guarantees. - Pointy

1 Answers

1
votes

Could you show some code?

else; try with javascript:

function OpenNew(){ window.open("http://www.google.se", "_blank"); }

Rgds