Using jquery address I’m setting my href links like so:
<a href="#view_profile=123">view 123</a>
When calling my address change event:
$.address.change(function(e) {
alert(e.value);
});
I see values from FF and Chrome as I would expect:
/view_profile=123
IE however returns the full URL path with a preceding “/” like so:
/http://localhost/#view_profile=123
Any idea why IE does this and what’s the best way to fix it? I’ve tried several things but it’s the same every time.
Here is the code that I use to get the link path:
// Setup jQuery address on some elements
$('a').address();
// Run some code on initial load
$.address.init(function(e) {
// Address details can be found in the event object
});
// Handle any URL change events
$.address.change(function(e) {
alert(e.value);
var urlAux = e.value.split('=');
var page = urlAux[0];
var arg = urlAux[1];
alert("page: " + page);
alert("arg: " + arg);
if (page == "/view_profile") {
...
}
});
I found a work around. If I add a class tag to the link and look for a click event on the class I can set the URL and it triggers the jquery address change event correctly.
I also had to set the href value to the ID like so: