Get current URL

Hello,it should be a simple task but I can’t get it done, I’m trying to get the current URL but no matters what I do, I always get the previous URL:
I try this:
window.location.href
$(location).attr(‘href’)
FlowRouter.current()
I spouse it’s because those lines are in the “<a>” element click event, so the moment the code runs I still in my previous Page (the new one isn’t rendered yet), where I need to put the “location.href” line so it give me the correct current URL, thanks in advance

did you try with FlowRouter.watchPathChange() ?

( see https://github.com/kadirahq/flow-router#flowroutercurrent )

I think you should try getting the new url when the app is done loading. Try the onRendered() feature for Blaze templates. it fires when it has completed rendering a page, i use this location often to plot charts etc.

asuming you use blaze as the template engine: http://blazejs.org/api/templates.html#Template-onRendered