How to open new tab with Router.go() function and pass some data?


#1

Hello
I would like to open new tab with Iron:Router. How can I open new tab with Router.go() and pass some data?


#2

I would like to need this options.


#4

This is not an answer to the direct question but it may give you an idea…

I have an application which some content is displayed embedded while some is displayed in new windows. Here is the Iron Router route definition.

Hope it helps.

Router.route('/:appName?/:uniqueId?', {name: 'Home',
    action: function() {
        Session.set('uniqueId', Date.now().valueOf());
        if (this.params.uniqueId) {
            if (this.params.appName) {
                var application = Applications.findOne({applicationName: appName},{});
                if (application) {
                    if (!application.applicationEmbed) {
                        window.open(application.applicationURL, '_blank');
                    } else {
                        this.render('EmbeddedContent', {
                            to: 'embedded',
                            data: function () {return {applicationURL: application.applicationURL};}
                        });
                    }
                }
            }
        }
        else {
            this.render('Banner', {to: 'embedded'});
        }
        this.render('Home');
    }
});

#5

Thank you for your help. I can use this :smile:


#6

You can also do window.open(FlowRouter.url(routeName, params, queryParams), '_blank') to wrap FlowRouter