Connecting Tech Pros Worldwide Forums | Help | Site Map

Reading URL anchor refrence

eggie5@gmail.com
Guest
 
Posts: n/a
#1: Sep 13 '06
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?


drclue
Guest
 
Posts: n/a
#2: Sep 13 '06

re: Reading URL anchor refrence


eggie5@gmail.com wrote:
Quote:
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
McKirahan
Guest
 
Posts: n/a
#3: Sep 13 '06

re: Reading URL anchor refrence


"drclue" <drclue@drclue.netwrote in message
news:1iJNg.524$UG4.273@newsread2.news.pas.earthlin k.net...
Quote:
eggie5@gmail.com wrote:
Quote:
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))


Closed Thread