Gnarlodious
Gnarlodious

Reputation: 324

Extract URL fragment

Having a hard time finding the URL fragment (the part following the '#' character) using Python 3.3.0. I tried

print(os.environ, file=sys.stderr)

However neither the 'REQUEST_URI' or 'QUERY_STRING' values have the fragment! What is going on and how to get the fragment?

Upvotes: 1

Views: 417

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1122252

The fragment is never sent by the browser when requesting a URL. It is a client-side-only piece of information.

If you alter just the fragment part (with Javascript or manually, in the location bar of your browser), no new request is made to the server; the browser simply updates the page scroll location.

Upvotes: 4

Related Questions