JavaScript + Meteor JS : How to open a link in new window ?

Use :

var win = window.open(url, ‘_blank’);
win.focus();

Example in a Meteor Js application:

clip.file

<template name="Clip">
    <div class="card-container">
      {...}
      <h4 class="watch"> <a href="#"> Go to </a></h4>
      {...}
    </div>
</template>

clip.js

Template.Clip.events = {
    'click .watch' : function(e){
        var win = window.open(this.link, '_blank');
        win.focus();
    }

};

1 Comment

Leave a comment