Intercepting static and dynamic links using javascript

Posted by soren.qvist on Stack Overflow See other posts from Stack Overflow or by soren.qvist
Published on 2010-06-05T19:00:19Z Indexed on 2010/06/05 19:02 UTC
Read the original article Hit count: 222

Filed under:
|
|

Hi, I'm currently developing an ajax application and I'm looking for a feature that lets me intercept all static and dynamic links using javascript. The links look like these:

<a href="link1/">link 1</a>
<a href="link2/">link 2</a>
etc.

I then want the browser to redirect to: current.page/#link1/ rather than current.page/link1/. I'm using jQuery, so the live() function is an option, however using that as a solution just seems rather sluggish to me(am I hysterical?). If there is a way to intercept ALL links on a page, maybe through detecting a change in the address, that would greatly help. I've tried a few plugins for jQuery (jQuery address & SWFaddress) but they only seem to have event handlers that respond to changes in anchor tags in the address. Any ideas?

thanks for your time

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery