RESPONSE.redirect(to a subanchor#everything behind disappears)
Hi everybody For a form-evaluation i want to redirect the user back to the form in case there is input missing. this is what I try: <pre> <dtml-call "RESPONSE.redirect('some_url?foo=some&bar=vars#subanchor')"> </pre> and this is what i get: some_url?foo=some&bar=vars annoying! I have concluded (knowing very little about Python), that somewhere within the Python-Part of the redirect method the tail of my url is interpreted as a comment. The Python documentation states, that # is indeed the start of a comment, unless it is part of a string literal. I would greatly appreciate any clues how to circumvent this problem... thanks in advance! -- mit freundlichen GrĂ¼ssen / best regards Hannes Wyss Konzeption & Entwicklung +41 1 350 85 86 www.ywesee.com > intellectual capital connected > www.nachahmer.ch
Hannes Wyss writes:
For a form-evaluation i want to redirect the user back to the form in case there is input missing.
this is what I try:
<pre> <dtml-call "RESPONSE.redirect('some_url?foo=some&bar=vars#subanchor')"> </pre>
and this is what i get: some_url?foo=some&bar=vars
annoying! I have concluded (knowing very little about Python), that somewhere within the Python-Part of the redirect method the tail of my url is interpreted as a comment. The Python documentation states, that # is indeed the start of a comment, unless it is part of a string literal. Your conclusion is wrong.
Indeed you need nothing to know about Python but about URLs (RFC 2396) and HTTP 1.1 (RFC 2616). As of RFC 2396, the fragment (your '#subanchor') is not part of an URL but only of an URL reference. As of RFC 2616, the "Location" header (used for redirects) must be an absolute URI, especially an URI and not an URI reference. A fragment is not allowed. Almost surely, the fragment is stripped by your browser. With respect to Python: inside a string (e.g. something enclosed in '...'), '#' does not start a comment but is part of the string. Dieter
participants (2)
-
Dieter Maurer -
Hannes Wyss