Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get the previous url in flask [duplicate]

I am using flask to do some user interaction. Basically, when the user clicks a button on page A or B, it goes to url C to get some data which does not have a visualization. After getting the data, I want to go back to the original page (A or B). How shall I find out where the user came from?

like image 505
nos Avatar asked Sep 29 '16 18:09

nos


People also ask

How do I redirect a previous page in Flask?

Another method you can use when performing redirects in Flask is the url_for() function. The way that url_for() works is instead of redirecting based on the string representation of a route, you provide the function name of the route you want to redirect to.

How do I get a URL for my Flask?

The url_for() function is used to build a URL to the specific function dynamically. The first argument is the name of the specified function, and then we can pass any number of keyword argument corresponding to the variable part of the URL.


1 Answers

I think what you need is request.referrer. There are some examples here

like image 105
Jean Cassol Avatar answered Sep 19 '22 05:09

Jean Cassol