Hassan Baig
Hassan Baig

Reputation: 15824

Getting a URL in python2.7

In a Djano project, I need to get the complete URL of my web app in a view, along with the URL's anchor tag. For instance, if the URL is:

http://example.com/#section0

I need to get that in its entirely, including the #section0 part. As you'd already know, HTTP_REFERER doesn't suffice (which is what I've tried).

What's a good way to read URLs in python/django? Beginner here, please advise.

Upvotes: 0

Views: 63

Answers (1)

MattCorr
MattCorr

Reputation: 371

Sorry, but the anchor tag is never sent to the server. The only way a server could know what it was is if the server itself sent the user to a url with the anchor tag. See here for more information:

Is the anchor part of a URL being sent to a web server?

Upvotes: 1

Related Questions