IE7 and onclick events

IE7 and onclick events

Reason
This is simply because of how IE decides to “remember” visited links (the one you call in the AJAX function), and it simply don’t run your onclick event more than perhaps once per click.

I solved this by adding something I’d like to call a no-cache-seed to the url that will be unique for every click, forcing the browser to handle every event as a new URL. Then it worked perfectly.

The following javascript snippet will create a variable with the number of seconds since January 1, 1970. Needless to say it will always be different unless you demand reaction times under 1 millisecond which is unrealistic from a single user.

var currentTime = new Date();
var nocacheseed = currentTime.getTime();

Code in effect:
http://example.com/file.php?foo=1&bar=1&nocacheseed=

Reload the page to see how it is different every time.

Leave a Reply