JavaScript trivia tidbit for all you FF2 developers

Did you know, that in Firefox 2, creating a link like:

[code lang=’html’]
click me!
[/code]

will actually open up the Firefox error console?

picture-25

You’d think it’d do nothing, since the href is just “javascript:”, but that’s not the case. To do nothing you need a bit more:

[code lang=’html’]
click me!
or
click me!
[/code]

Notice the semicolon in that first line. If you leave out that semicolon (or a void(0)), then your users will enjoy looking at the error console instead of your site – yikes!

Other fixes:

You can stop this from happening if you go to Web Developer’s Options
drop-down menu and then choose Options.  Then choose Miscellaneous tab
and untick all the boxes for Error Console.

change your a href with onclick
from something like:
[code lang=’html’]

[/code]

to:
[code lang=’html’]

[/code]

… in other words, just add ‘return false;’

Leave a Reply

Your email address will not be published.