Forum Moderators: coopster

Message Too Old, No Replies

Get the complete url

Get the complete url of the current page with all variables

         

jerodev

1:26 pm on Sep 3, 2010 (gmt 0)

10+ Year Member



Is it possible to get the complete url of the current page including the data after the #(hash) sign?
If not, can it be done in another language?


Thank you,
Jerodev

Matthew1980

2:34 pm on Sep 3, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there jerodev,

Welcome to WebmasterWorld :[webmasterworld.com ]

How are the URL's formed that you want to read, could you give an example of what your looking at getting?

Cheers,
MRb

astupidname

10:25 pm on Sep 5, 2010 (gmt 0)

10+ Year Member



PHP by it's self can not get the data after the hash, the hash is purely a client-side thing which you will be able to get with javascript using the window.location.hash property. It will include the '#' sign at beginning so is better as: var hashData = window.location.hash.replace(/#/, ''); What you do with it from there is up to you I guess, commonly either set in a cookie or sent via ajax to server, or set in a hidden form field, depending upon what you want the info for.

jerodev

8:52 pm on Sep 6, 2010 (gmt 0)

10+ Year Member



Thank you, it worked using javascript and ajax.