<a href="javascript: void(0);"
onclick="window.location.href='/foo.bar?one=false&two=true'">Link</a>
works like a charm in Firefox. I get NOTHING in IE. but if I replace
the javascript: void(0) with just a #, then it works in IE. wtf? Any
help.
This from a recent Richard Cornford post seems appropriate:
"IE treats the activation of a javascript pseudo-protocol HREF as
navigation, and when used the browser goes into a 'waiting state'
pending the arrival of a replacement for the content. In this
state many previously available browser facilities are withdrawn,
including GIF animation and image swapping.
"The normal strategy for dealing with this issue is to never use a
javascript pseudo-protocol HREF that will not result in the
replacement of the contents of the current page (so never to execute
a function for its side effect).
"Usually the same effect as a javascript pseudo-protocol HREF can be
achieved (without the detrimental consequences in IE) with a suitably
default action cancelling intrinsic event handler. An onclick
handlers are the usual replacement."
<URL:
http://groups.google.com/group/comp...ity,+img+elements+dissappear#ed05d2132efcf609
So the solution is:
<a href="whyLinkDidntWork.html"
onclick="window.location.href='/foo.bar?one=false&two=true'">Link</a>
Bots (if they're not smart enough to follow the onclick) will get the
same text page that users sans JS get.