Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
829 views
in Technique[技术] by (71.8m points)

url - How to get hash in a server side language?

As far as I know, there's no way to get url hash in a server side language since hash urls are not being sent to the server side. One of my co-workers told me that it should be possible in java (jsp) or Ruby. Since I tested it on PHP, but it simply doesn't work. I googled about ruby and jsp, but had no luck. He also mentioned that the first access (http://domain.com/index.php#test ) is accessible from a server side.

in PHP, printing our $_SERVER variable doesn't have anything about hash

Is this really possible in other server side languages?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Short answer: no, it's a client side only thing.

Slightly longer: It's called Fragment identifier and is client side only - browser doesn't send that part of the url to the server. It's not possible in any language unless you are using some browser implementation (or software) which would send that part of url to the server. Reference: http://en.wikipedia.org/wiki/Fragment_identifier


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...