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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s