>
> I am writing a web2py application wherein I want my controller to behave 
> differently to following URLs
>
> /user/login
>
> /user/login#_=_
>

The "_=_" after the # is a fragment identifier, and the browser does not 
send fragment identifiers to the server, so web2py has no way to 
differentiate between those two URLs (the server will simply receive a 
request to /user/login in both cases). You can use a query string instead, 
such as /user/login?q=_%3D_ (note, "%3D" is a url-encoded "="). In that 
case, the "_=_" will be available in request.vars.q in your app. If you 
want, I suppose you could use some Javascript on the client side to capture 
changes in the fragment identifier and automatically convert to a request 
with a query string (that's roughly how hashbang URLs work, though using 
Ajax requests to fetch the requested data).

Anthony

Reply via email to