Dynadot โ€” .com Transfer

Html or Javascript Links?

Spacemail by SpaceshipSpacemail by Spaceship
Watch

Ookie

Established Member
Impact
13
Hey,

Just wondering which you guys prefer when coding menus?

location.href='site'

and link the whole div

or ahref

and just link the text?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You'll sometimes run into people who have javascript disabled. If your menu is completely JS, you can go with the location.href. However, I'm fairly sure it's still considered good practice (especially if you're doing any strict work) to use <a> tags. The latter is my personal preference.


Bruce
 
0
•••
Depends on what you are doing. When you are opening something in a new window, I would go with javascript. XHTML doesn't support the target part of a link tag.
 
0
•••
Always avoid javascript and use HTML links when possible.
This is for SEO purposes too.
It's difficult for the search engines to traverse JS links.
 
0
•••
Always avoid javascript and use HTML links when possible.
This is for SEO purposes too.
It's difficult for the search engines to traverse JS links.

Not when you have a sitemap as well as the google sitemap. There are pros and cons to each. And always make sure you have a backup for when people don't have javascript enabled. I would agree that static links would be best for the most part though.
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back