java - Getting hash parameters from request url -
i have such url - http://www.coolsite.com/daily-plan/#id=1 easiest way parse string , read hash value (the value after #id=)? thank you
on client side (i.e. javascript) can check window.location.hash
hash. on server side, general answer 'it impossible' since hash not sent in request server.
upd: maybe misunderstood question. answer how hash part of url either in browser or in server side code during request processing, not string processing.
upd2: answer comment here because doesn't fit in comment.
how work when user clicks on navigational links?
i assume hash changed , corresponding content downloaded via ajax request web service or rest.
for example if user has url www.example.com in browser , page shows list of product categories. user clicks 1 category , url changes www.example.com/#id=5 , products category(with id=5) downloaded via ajax , shown on page. no postback, partial page refresh.
is close scenario?
now want user paste/enter www.example.com/#id=5 directly in browser address bar , go directly list of products in category.
but /#id=5 not sent server request browser, there no way value on server side, , can nothing since browser decided not send data , don't have on server side.
in our project use solution when server returns common page code/html, i.e. header, footer, without main/center part of page. there javascript code executes right after common html loaded. takes window.location.hash
, sends web service via ajax , web service returns content (html) main part of page.
Comments
Post a Comment