0

I am using meteor.js.

How can I direct the client to a url without the click of a button. I am retrieving a url from the server and have this url set in session a variable.

 Session.set('grSignInUrl', result)
//result =  http://www.goodreads.com/oauth/authorize?oauth_token=6mLjmfytrCj695y98S
 window.location = result;

Only when there is a value in this session, I would like the users browser to direct them to this url. How can I achieve this?

meteorBuzz
  • 3,110
  • 5
  • 33
  • 60

1 Answers1

1

This is untested, but something like this:

Tracker.autorun = function() {

    var link = Session.get('grSignInUrl');
    if (link) {
        window.location = link;
    }
}

The autorun will be called each time the session variable changes.

Christian Smorra
  • 1,756
  • 11
  • 13
tarmes
  • 15,366
  • 10
  • 53
  • 87