Reputation: 139
How can I get the URL using ColdFusion?
I tried the following but it did not return the Named Anchor.
For example http://www.makeup.edu/test/#abc
<cfdump var=#cgi#>
Upvotes: 3
Views: 1097
Reputation: 267
Add an additional url parameter to identify the anchor. So you could create the link http://www.makeup.edu/test/?anchor=1#abc
The user clicks on the link and the anchor goes to the right place and then you could use:
<cfif ISDEFINED("url.anchor")>
<cfif url.anchor EQ 1>
... do stuff here...
</cfif>
</cfif>
Upvotes: 1
Reputation: 32915
You can't, 'cause although it is in the URL, it is only meant for the client. It will not be sent to the server, therefore you can never find that in the CGI scope.
Upvotes: 9
Reputation: 29870
As Henry says, you can't get them with ColdFusion because they are never sent with the request. What you need to do is to pull them out with Javascript (which can access them), and then send them back to the server via some other mechanism, like putting them in a cookie or something. It depends on the situation as to how you tackle that part, but it's probably a different question anyhow.
Bottom line: the info is never transmitted with the request, so the web server doesn't get it, so the web server cannot pass it to ColdFusion, so ColdFusion does not receive it.
Upvotes: 4