大网数据广告活动
网站运营与故障问答

Does e.preventDefault on link prevent the page from being crawled?

· 52CE 我爱测

I have a couple of links in navigation on homepage that lead to new pages. When clicked on link, i want to prevent going on that page ( e.preventDefault() ), and instead load that page in popup with ajax. JS disabled users would …

问题原文

原帖链接 · user2406735 · CC BY-SA 3.0

I have a couple of links in navigation on homepage that lead to new pages. When clicked on link, i want to prevent going on that page (e.preventDefault()), and instead load that page in popup with ajax. JS disabled users would go to the page from link. Can this hurt SEO in any way? Would those pages get crawled?

社区高分解答

原帖链接 · Martijn · CC BY-SA 3.0

The pages will be found and most likely be crawled. You're not far from the truth if you assume bots don't use Javascript.

A crawler works similar to this:

  1. Go to a webpage and get it's contents
  2. Get all the information from the page, like keywords and all other SEO checks
  3. Get all internal and external links from the source
    • Per link, go to step 1.

It takes the source, not the page the user sees. Some bots do excecute some javascript, but it won't stop them finding and crawling the urls.

If you want bots not to follow the urls on a page, there is NOINDEX (says: Do not index this page) and NOFOLLOW (index this page, but don't follow the urls. More information about the robots meta.

Another option is to use robots.txt, a small textfile where you can add url's to pages you don't want them to index. This does depend on trusting they'll actually listen to it (but they most commonly do).

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Webmasters Stack Exchange
适用范围
以原帖系统、软件版本与发布日期为准(2015-06-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。