- Create Account

IE6 - "return false" on hyperlinks no longer works

Forums > SuperNote > IE6 - "return false" on hyperlinks no longer works
Author
Message

1) swinbank Group: Members
Posts: 2 Joined: 13 Feb 2007 Location: United Kingdom IP: 217.34.--.--
This issue applies to IE6, but not Firefox or Opera.

"return false" in an onclick handler should stop a hyperlink begin followed. But if a supernote is instantiated (you don't even need to use it), this no longer works on IE. Test case follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Test case</title>
<script type="text/javascript" src="js/supernote.js"></script>

<script type="text/javascript">
var supernote = new SuperNote('supernote', {animOutSpeed: 1.0, hideDelay: 400});
</script>
</head>
<body>
<a href="http://www.twinhelix.com" onclick="alert('You don\'t want to go to Twinhelix.');return false;">Take me to Twinhelix!</a>
</body>
</html>

Thanks in advance for any help.
Phil

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 125.236.--.--
SuperNote hooks into the document click capturing process. I'll look into this -- I'm currently tweaking my event management library code so that might help too.

In the meantime, try this:

onclick="cancelEvent(event, true)"

which uses the event management library directly to kill the event, as "return false" can be a little spotty in general.

Thanks - Angus.

3) swinbank Group: Members
Posts: 2 Joined: 13 Feb 2007 Location: United Kingdom IP: 217.34.--.--
Wow - thanks for the fast reply.

That workaround works perfectly for me, so it's job done as far as I am concerned.

Thanks again
Phil

4) Amy Group: Guests
IP: 67.135.--.--
I believe this is close to a "jumping" issue I have (the page jumps to the content onclick). You can see my implementation of it at:
http://www.jocobusiness.net/default.aspx?id=512

I  tried onclick="cancelEvent(event, true)" on the link, but it stopped the supernote too. Eep! This seems like it is a simple issue. Thank you for your advice!

This script is absolutely wonderful!

In peace,

Amy

5) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.173.--.--
Hey,

Looks like an interesting implementation! Before we go much further though -- have you perhaps perused the script license agreement? I ask people to either link back here or make a donation instead, have you guys considered doing either?

Anyway, the click-scroll thing doesn't appear to happen with the demo script at all with the click notes. I'm not entirely sure what's causing it at first glance on your page! The cancelEvent call mentioned above could be embedded inside the click handler function in the core script if you want, and you don't have any other scripts that need to process the document click event. In short:

1) Open supernote_commented.js
2) Find "SuperNote.prototype.mouseHandler", and towards the end of that, replace:

if (note.click  && (srcElm == trigRef)) cancelEvent(evt);

with:

if (click) cancelEvent(evt);

which may improve the symptoms somewhat. Let me know how it works.

- Angus.

6) Amy Group: Guests
IP: 67.135.--.--
That worked beautifully! Merci beaucoup! :-) Right now I am testing the script in our various layouts before implementing it on the library's large site. A note about the script and your site is on our accessibility page at:
http://www.jocobusiness.net/templates/JCL_InfoPage.aspx?id=748
Is that all right, or does it need to be on every page?

7) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.173.--.--
Oh, that should be fine. Glad to have fixed it!

Cheers - Angus.

Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.