Reputation: 513
I have problem with dynamically opening new window from already opened window. There are several links on the page, and since I have script to do before change page is fired and cannot simply add target="_blank"
, I do like this:
<a href="somelink" class="someclass">Blah Blah</a>
and in javascript
$(document).on("click",".someclass",function(event){
let href = this.href;
event.preventDefault();
/*
...
here I do some stuff
...
*/
window.open(href,null);
});
and this IS opening a new window (new tab). On that newly opened window there are also links with .someclass
class but when clicking on that link all is done except it is not opening in a new window, instead it is opening in the same window.
Any idea how to fix that?
Upvotes: 1
Views: 34
Reputation: 513
I have figured it out... problem was "null" parameter for window. I just put
window.open(href, Math.random()+"");
and it is working.
Upvotes: 1