[web2py] get last visited page
Hello, I would like to know if there is a built vars to know what was the last page a user had visited? I would like to build a basic navigation bar that will contain a back button and I would like to know what was the last visited page so I could write rule for different view depending from where the user come from the back button will redirect at the rigth place. Thanks Richard
[web2py] get last visited page
Request.ENV.referer but it's not super reliable.
Re: [web2py] get last visited page
I thougth this : In view I can get active url or function or what ever... : {{session.last_visited_url=request.url}} Last visited url : {{=session.last_visited_url}} But then I would need to actualize these session variables on any events that when the user make action... But I am blocked if the user use the navigator button... Richard On Tue, May 24, 2011 at 12:14 PM, pbreit pbreitenb...@gmail.com wrote: Request.ENV.referer but it's not super reliable.
Re: [web2py] get last visited page
a href=javascript:void(history.go(-1))img src={{URL('static', )}}/a puts an image link that simulates the back button on the page. You could convert it to button and use the jQuery alternative Too much of a hack? The web2py framework is very good with history integration.
Re: [web2py] get last visited page
You could put this at the top of your controller files (outside a def():) and it would happen on every page visit: session.last_visited_url=request.url
Re: [web2py] get last visited page
Thanks for the hint pbreit! I think the : javascript:void(history.go(-1)) will do it for now... Thanks all for your help. Richard On Tue, May 24, 2011 at 12:42 PM, pbreit pbreitenb...@gmail.com wrote: You could put this at the top of your controller files (outside a def():) and it would happen on every page visit: session.last_visited_url=request.url