0

Possible Duplicate:
How can you check for a #hash in a URL using JavaScript?

Currently I am generating Urls that look like this:

InspectionPhotos.aspx?inspectionId=10001649#/2

The #2 is for a photogallery plugin, and this would mean go the second photo.

I would like to show a div only if there is a #/[anynumber] but if its just InspectionPhotos.aspx?inspectionId=10001649 then not show anything.

How could I do this check? Either asp.net on pageload or a client side javascript would be fine.

Thanks.

Community
  • 1
  • 1
Kyle
  • 32,731
  • 39
  • 134
  • 184

2 Answers2

2

You can't do this in server side, because the hash is not sent to the server, to get this value with javascript is simple:

var hash = window.location.hash;
if (hash){
   //use the hash value.
}
Gustavo F
  • 2,071
  • 13
  • 23
0

JavaScript: window.location.hash will comeback with #/2 from your example.

The Muffin Man
  • 19,585
  • 30
  • 119
  • 191