Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to catch the full url including #

Tags:

url

php

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

like image 833
Jack Maessen Avatar asked Oct 17 '25 19:10

Jack Maessen


2 Answers

Plz Refer Below Link

Get Full Url in PHP

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

like image 178
Tarun Bhati Avatar answered Oct 20 '25 10:10

Tarun Bhati


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.

like image 41
prava Avatar answered Oct 20 '25 10:10

prava



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!