internet explorer - Unable to set correct href link in IE with jquery address -
Using
I am setting up my href link in this way:
< Code> & lt; A Href = "#view_profile = 123" & gt; View 123 & lt; / A & gt;When my address change event is called:
$ Address.change (function (e) {alert (e.value);});
I see values from FF and Chrome as I expect:
/ view_profile = 123
IE, however, returns a full URL path like "/", the previous one:
/ http: // localhost / # view_profile = 123
Any ideas why IE and what is the best way to fix it? I have tried many things, but this happens every time.
Here is the link I use to get the link path:
// Set Up on some Jakoose Address Elements $ ('A'). Address (); // Run some code at initial load $ .address.init (function (e) {// address details can be found in event item}); // 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); Warning ("Arg:" + RG); if (page == "/ visual_profile") {...}});
I got work around If I add a class tag to the link and search for a click event on the client, then I can set the URL and it correctly triggers the occurrence of the jquery address change.
$ ("testclass") .click (function () {var id = null; if ($ .browser.msie) {id = $ (this) .attr ('href') Piece ($ (this) .attr ('href') IndexOf ('id') + 1);} Other {id = $ (this) .attr ('href'). Substr (1);} Warning ( "Id:" + id); location.href = "# view_profile =" + id; return false;});
I also had to set the href value to the ID like this:
& lt; A href = "# 123" class = "testclass" & gt; 123 & lt; / A & gt;
Comments
Post a Comment