Think this should work. 'stage' assumes you're referencing the object tag. If 'stage' is a class or id, would need to update accordingly.
$('stage').mousedown(function(ev){ // Attach mousedown listener
if (ev.target.targetNode) { // if clicked object has 'targetNode'
ev.preventDefault(); // prevent additional bubbling
window.location.href = 'http://www.google.com'; // Send browser to url
}
});
You could also store the url on the clicked objects as an attribute or data, and grab it when clicked.
<thing data-myUrl="www.website.com"></thing>
.. and:
window.location.href = $(ev.target).data('myUrl')
EDIT:
Using the functions from the link you provided, your function should be:
stage.on('mousedown', function(evt) {
var shape = evt.targetNode;
if (shape) {
window.location.href = 'http://www.google.com';
}
});
.. so this will send the browser to your url, anytime the user clicks on anything that has ANYTHING as its 'shape' value. You could use (shape === 'circle')
or whatever if you wanted to be more specific about what they clicked on. ('circle' is a guess, your actual shape values may differ)