Anchor Tags - how to retreive them via Classic ASP

Hi All,

If I have a classic asp script like the following;

DisplayMakes.asp#4532

How do I grab the anchor portion of the page name, i.e. 4532 via my asp script?

Regards

JamWales
JamieAsked:
Who is Participating?
 
sybeConnect With a Mentor Commented:
Interestingly Classic ASP can't do that (as others have made clear).

But then again: why would you? The anchor is (or should not be) not of interest to the generation of the page. It is only an indication for the browser where to jump in the page. It is a client-side concept.

 If it is of interest in the generation of your page, you should rethink your concept and use the value in a querystring.
0
 
G_HCommented:
(UNTESTED)

Maybe something like:

 
ScriptName    = Request.ServerVariables("SCRIPT_NAME")
if InStr(ScriptName, "#") > 0 then
  arrScriptName = Split(ScriptName, "#")
  LastSectionThatYouAreInterestedIn = arrScriptName(UBound(arrScriptName))
else
  '' ## NO HASH
end if

Open in new window


GH
0
 
JamieAuthor Commented:
Hi G_H ,

Thank you for your reply - unfortunately that does't work, as the #4532 does not appear in the script name.

Regards

JamWales
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
BanthorCommented:
Is the Number 4532 possibly in the forms collection.
Doe he URI DisplayMakes.asp#4532 appear in the link of the previous page?
0
 
JamieAuthor Commented:
Hi Banthor,

No it's not  - but as it turns out, following further research, I'm asking the impossible;

http://www.mikeduncan.com/named-anchors-are-not-sent/

Needs to be done via JQuery/Javascript - with me then picking us the result via asp someone?!

Regards

JamWales
0
 
JamieAuthor Commented:
Hi Banthor,

Apologies - I forgot to thank you for your reply to my question - as I do rely heavily on EE when I have a problem - and do appreciate all replies I receive.

Regards

JamWales
0
 
JamieAuthor Commented:
Hi All,

Got it working, although probably not in the most elegant of ways;

<script type="text/javascript">
AnchorTag = location.hash;
document.cookie= "AnchorTag" + "=" + AnchorTag;
</script>
<%
AnchorTagASP = & Replace(Request.Cookies("AnchorTag"),"#","")

Any better way of achieving this?

Regards

JamWales
0
 
JamieAuthor Commented:
Hi All,

I spoke far too soon - further testing shows my solution does not work at all - so back to the drawing board!

Regards

JamWales
0
 
JamieAuthor Commented:
Hi Sybe,

I was trying to avoid using querystring - and was looking to trap the archor tag, so that I could increase the font size/color to the jump to point on the webpage, but as you say this is not possible.

Regards

JamWales

0
 
BanthorCommented:
Makes perfect sense, the #Anchor tag is a location in the document and the document does not exist until rendred.
0
 
JamieAuthor Commented:
Hi Sybe,

Whilst I now accept what I ask is impossible - it would have been nice had it worked!

Regards

JamWales
0
All Courses

From novice to tech pro — start learning today.