intercept local link clicks on a page
This is useful for doing client-side pushState UIs.
Given some html:
We'll intercept the relative links
<host>/b, printing them.
The external link to npmjs.org will go through as usual.
var catchLinks = ;;
var catchLinks =
cb(href) whenever an anchor tag descendant of
element with an in-server
url is clicked.
href will always be a relative path rooted at the root path.
With npm do:
npm install catch-links
Use browserify to bundle this library into your project.