1

How can I extract the parameters from this type of URL.

 "  ../oauth/#access_token=sa7a56437de94d2d351c5&token_type=score "

I could split by the "#" and then get all the vars, the problem is that I can't get the full url, just the part before the #.

Thank you

Swapnil Patil
  • 971
  • 2
  • 18
  • 41
andreffs
  • 85
  • 1
  • 9
  • 6
    The part after the `#` is only being processed on the clientside, not sent the serverside. – Nils Werner Oct 01 '13 at 10:35
  • You may consider using '?' instead of '#' and then the parameters become a GET query. Thus you could access parameters simply with `request.GET.get("access_token")` – esauro Oct 01 '13 at 11:11

1 Answers1

3

This simply cannot be done as the contents after the # mark are not sent to the server. You might consider adding the information after the ? or query string.

However, if you have to send it, then you might consider sending a GET request using javascript. You can get the current url by document.URL However, you will need to make a specific URL route to handle this.

The best option is to use ? or the query string.

Games Brainiac
  • 80,178
  • 33
  • 141
  • 199