链接需要href吗? [英] Is href required on links?
问题描述
我之所以这么问是因为我有一些链接就像按钮一样通过 ajax 拉出内容,所以我不需要它们的任何 href.
I'm asking this because I have some links that act like buttons that pull out content trough ajax, so I don't need any href on them.
(我是从 SEO 的角度提出这个问题的)
(I'm asking this from the SEO perspective)
推荐答案
链接是否需要 href?
Is href required on links?
是的.没有 href 属性的锚点不是链接.
Yes. Anchors without href attributes are not links.
我之所以这么问是因为我有一些链接就像按钮一样通过 ajax 拉出内容
I'm asking this because I have some links that act like buttons that pull out content trough ajax
如果你正在这样做,那就做对了.使用 非侵入式 JavaScript 和 pushState.
If you are doing that, then do it right. Use Unobtrusive JavaScript and pushState.
仅当您使用定点设备并打开 JS 时才有效的链接"不是好的链接.
"Links" that only work if you are using a pointing device and have JS turned on are not good links.
我是从 SEO 的角度提出这个问题
I'm asking this from the SEO perspective
搜索引擎不会执行您的 JavaScript,因此伪链接(依赖于 JS)就它们而言只是虚无的黑洞.
Search engines won't execute your JavaScript, so the pseudo-links (which depend on JS) are just black holes of nothingness as far as they are concerned).
这篇关于链接需要href吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!