One of my script is being called as
script.php?l=addr#anchor
I found, using SESSION [REQUEST_URI] or QUERY_STRING, gives script.php?l=addr
Is there a way to get the #anchor too using php?
Thanks in advance
One of my script is being called as
script.php?l=addr#anchor
I found, using SESSION [REQUEST_URI] or QUERY_STRING, gives script.php?l=addr
Is there a way to get the #anchor too using php?
Thanks in advance
You can do this by using parse_url() function.
sorry, can not be done with PHP, unless given directly to the link. USE Javascript(Use Framework jQuery).
Example:
CURRENT URL: website.com/index/#my-id
jQuery Code:
PHP Code:
Bye!!
The anchor is not usually available serverside. It is a guide to the browser. If you really want to know what anchor is called, and you have control of the site you can add &anchor=anchor at the end of your url.
If you don't have control of the place where your script is called, I don't think you have much of a chance.
Regarding the post below: It is true that you can use parse_url() to retrieve the anchor part of a given url. The issue here is that you do not have access to the full url ( including anchors ) from php.