471,594 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 software developers and data experts.

Reading URL anchor refrence

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
2 37810
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
"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.

Similar topics

11 posts views Thread by pmclinn | last post: by
10 posts views Thread by elibol | last post: by
161 posts views Thread by KraftDiner | last post: by
5 posts views Thread by SamirM | last post: by
3 posts views Thread by Joseph Gruber | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.