views:

64

answers:

3

I'm not sure if I have seen this right but using the jQuery UI Themeroller the current theme settings seem to be stored in the URL like http://www.site.com/page.html#theme-details...

Is there a way to extract the data from this using javascript? So I would return something like

theme-details...

From the URL I just mentioned

Or have I got it wrong?

+1  A: 

If you want the fragment identifier of the current document’s URL:

location.hash

And if you want it of a string:

str.match(/^[^#]*#(.*)/)[1]
Gumbo
+1  A: 
window.location.hash

will return the part of the URL that follows the # symbol, including the # symbol.

window.location.hash.substring(1);

will return theme-details...

See more on

window.location

here

rahul
+1  A: 
document.location.hash.substring(1) // will return "theme-details" minus the hash
Jason Berry