troubleshooting Question

IE7 a href + onclick - both happen!

Avatar of peterchamberlin
peterchamberlin asked on
Web Languages and StandardsJavaScriptWeb Browsers
12 Comments1 Solution3722 ViewsLast Modified:
I have an annoying behaviour in IE7. With an HTML page containing the following script...

<a href="" onclick="'', 'popup'); return false">Click me</a>

...if I click the link then I get a popup window, but the launching page also navigates to the href location behind it. Seemingly the href happens before the onclick event, or the onclick return value is not taken into consideration properly.

What's strange is that on other XP PCs here with IE7 it works okay, but on my work machine and home machine it doesn't. My suspicion is that VS 2005 has had some impact. I'm on VS2005 SP1 here, and original version at home.

I have reset all of IE7's settings to try to get around this problem but to no avail. I have also uninstalled the IE7 Beta3 developer toolbar. Even running in no-addon mode has no effect. Both machines are fully-patched XP SP2. I have also installed IE7 atop itself, installed M$ Script 5.6, copied registry settings from HKLM/HKCU Internet Explorer and Internet Settings from another correctly behaving XP SP2 / IE7 machine. I've tried logging on as local machine admin for a clean HKCU, nothing has fixed this.

I found some people claiming this same issue on newsgroups, others trying similar example code and getting the correct result, but no explanation in either case as to what was wrong.

This issue only affects IE7, not IE6 or Mozilla Firefox.

Thoughts, suggestions or solutions all welcome!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros