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

Detect if client changes URL

P: n/a
On my page I have links like this:

<a href="#files/home.html"><img id="home" src="images/home.png"
alt="Home" width="36" height="10" /></a>

which will append "#files/home.html" to the URL in the browser. I need
to figure out how to detect this event.

How can I detect if the client clicks on a link like <a
href="#files/home.html">?

Oct 16 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a

eg****@gmail.com wrote:
On my page I have links like this:

<a href="#files/home.html"><img id="home" src="images/home.png"
alt="Home" width="36" height="10" /></a>

which will append "#files/home.html" to the URL in the browser. I need
to figure out how to detect this event.

How can I detect if the client clicks on a link like <a
href="#files/home.html">?
You can generically add an onunload event handler to the page.

If you need to know about each link you can add on onclick event
handler to the anchors.

Oct 16 '06 #2

P: n/a
On Oct 16, 3:27 pm, "egg...@gmail.com" <egg...@gmail.comwrote:
On my page I have links like this:

<a href="#files/home.html"><img id="home" src="images/home.png"
alt="Home" width="36" height="10" /></a>

which will append "#files/home.html" to the URL in the browser. I need
to figure out how to detect this event.

How can I detect if the client clicks on a link like <a
href="#files/home.html">?
Onload of the page, you check the Hash property.

window.onload = checkIt
function checkIt(){
//check the URL of the current page
}

Now, open your page, click one of your links, then click another one.
Unless you are careful and watch for it, you will end up with a
malformed URL that has two #'s in it.

--
Randy

Oct 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.