Jack Maessen
Jack Maessen

Reputation: 1864

how to catch the full url including #

How can i catch the current full url including the # sign when it is in it?

My url looks like this: http://example.com/spf#users/admin

When using this code:

$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
echo $url;

he outputs this only: http://example.com/spf It should also catch the #users/admin behind it

Upvotes: 4

Views: 10570

Answers (2)

prava
prava

Reputation: 3986

This isn't possible with "standard" HTTP to get the URL fragment as this value is never sent to the server. You would need following JavaScript on the client side.

Use window.location.hash in JavaScript and do any operation.

Upvotes: 2

Tarun Bhati
Tarun Bhati

Reputation: 141

Plz Refer Below Link

Get Full Url in PHP

at Client Side You can use javascript to get hash value with window.location.hash

Upvotes: 4

Related Questions