title: Pass window.location to Flask url_for
body: <p>I'm using python.On my page when an anonymous user goes to the sign in page, I want to pass a variable to the backend so it indicates where the user is coming from ( send the URL).</p>
  
  <p>So when the user clicks on this anchor link: </p>
  
  <pre><code>&lt;a href="{{ url_for('account.signin') }}"&gt;Sign in&lt;/a&gt;
  </code></pre>
  
  <p>I want to send current URL of the page where the user is currently.</p>
  
  <pre><code>&lt;script&gt;
   var current_url = window.location.href;
  &lt;script&gt;
  </code></pre>
  
  <p>I thought to send it like this:</p>
  
  <pre><code>&lt;a href="{{ url_for('account.signin', current_url="window.location.href") }}"&gt;Sign in&lt;/a&gt;
  </code></pre>
  
  <p>But I can't use javascript code inside url_for or how can I pass it? </p>