By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,480 Members | 1,743 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,480 IT Pros & Developers. It's quick & easy.

Reading URL anchor refrence

P: n/a
Hi,

I have a URL in my app that looks like this:

http://codinginparadise.org/my_ajax_app#helloworld

How - using javascript - can I read the "helloworld" from the URL
string?

Sep 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
eg****@gmail.com wrote:
Hi,

I have a URL in my app that looks like this:

http://codinginparadise.org/my_ajax_app#helloworld

How - using javascript - can I read the "helloworld" from the URL
string?

self.document.location.hash

actually to get just "hellowworld" and not "#helloworld" that
would be like

self.document.location.hash.substring(1)
Hope that helps
Sep 13 '06 #2

P: n/a
"drclue" <dr****@drclue.netwrote in message
news:1i***************@newsread2.news.pas.earthlin k.net...
eg****@gmail.com wrote:
Hi,

I have a URL in my app that looks like this:

http://codinginparadise.org/my_ajax_app#helloworld

How - using javascript - can I read the "helloworld" from the URL
string?


self.document.location.hash

actually to get just "hellowworld" and not "#helloworld" that
would be like

self.document.location.hash.substring(1)
If the URL contains spaces (or other escaped characters):
http://codinginparadise.org/my_ajax_app#hello%20world
then use:
unescape(self.document.location.hash.substring(1))
Sep 13 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.