"javascript: void(0)" links sometimes break event handlers in internet explorer
A while back I ran in to a problem where after clicking an anchor with "javascript: void(0)" events just stopped firing. I read that following a link puts the page in a different state and in that different state events don't fire. Even though the link is not real, it sometimes confuses IE. Anyway, I removed the "javascript: void(0)"'s and the problem has not been seen again.
Now, in a different application I am seeing the same thing... kinda. Clicking the "javascript: void(0)" sometimes has no ill effect. But then for some rea开发者_运维技巧son or another after clicking the bad link the page will stop working. Once this happens it will continue to happen consistently until the client machine is rebooted. After reboot, you are back to it sometimes happening. Crazy right? Reboot fixing a web page!?!?!
So, my question is has anyone seen this before? Can anyone give an explanation for this issue? Any documentation on this issue? I can't seem to find anything on it again. Does this even make sense?
I already know "javascript: void(0)" is bad practice... I am just looking to understand the issue. Specifically, this is IE7.
Thanks for reading!
UPDATED:
you definitely must read this:
*...Upon entering this state IE stops doing many of the things that it was previously doing, and it stops providing, or allowing the scripting of, various facilities that it had previously provided....
...They take the general form of reports of IE exhibiting particular behaviour up until the point when a user first clicks a javascript pseudo-protocol HREF and then behaving differently (usually less desirably) from then on until the page is re-loaded...*
http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/d156ea8137cdd1b4/1c07ad60e4d8fe1f?q=IE+javascript:void&rnum=3#1c07ad60e4d8fe1f
i think read this may help you!
Which "href" value should I use for JavaScript links, "#" or "javascript:void(0)"?
javascript void(0) problem in IE
btw must of the time can be a cookies problem or a script problem!
精彩评论