I agree. As a "power user" who regularly opens links in multiple tabs
any link to "nowhere" bothers me. Even Thomas' solution doesn't
behave properly on a middle-click, (or shift-click, or whatever OS-
specific combination I need to open a link in a new tab).
If it must be a link, link it to something other than javascript.
Otherwise, trap the onclick behavior, which can be done for any
visible element.
Even better, do both, and use javascript to remove the now
superfluous link.
TAG
On Aug 15, 2006, at 12:01 PM, Hill, Greg wrote:
I'm going to go against the grain here and say I hate it when
people use
# as the link. It makes the browser jump to the top of the page,
and it
adds a page to the history. Maybe most people prefer that, but I'm
not
one of them.
Greg
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:rails-spinoffs-
[EMAIL PROTECTED] On Behalf Of Thomas Fuchs
Sent: Tuesday, August 15, 2006 10:38 AM
To: [email protected]
Subject: Re: [Rails-spinoffs] Completely off-topic, so flame me
"If I hit Ctrl+Alt+Del the computer reboots!"
Anyway, the accepted "normal" solution to this is:
<a href="#" onclick="blablabla(); return false">bla</a>
This makes sure:
- page will validate, as "#" is a valid URL
- link doesn't do anything (expect for jumping to the top of the
page) when Javascript isn't active
- shift-click stuff shouldn't break things (probably doesn't do what
the user wants either, but...)
- "return false" makes sure the browser won't follow the link after
your JS stuff has run
-Thomas
Am 15.08.2006 um 17:23 schrieb Sam:
There's a lot of old-solutions to this problem lingering on Google,
so it's difficult for me to determine if there's a more modern
solution to this problem. A customer posted a complaint yesterday
about how I'm coding href's when an onclick event is used and the
href should not be used. It seems the complaint is that holding
the shift key and clicking the link opens a new window pointing to
javascript:void(0).
Reminds me: Doctor, it hurts when I hit my head with this
hammer... (don't hold the shift key and click might be a solution)
href="#" // I never do this
href="javascript:void(0)" // this is what I do, but I read void(0)
is deprecated over null?
should I use something else?
Sam
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs