Reputation: 3200
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?
Upvotes: 0
Views: 135
Reputation: 15442
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.
Upvotes: 1