URL 是我们进行网络活动中很重要的概念,一个URL中可以包含域名,路径和参数等,
https://www.example.com/fruits.html?from=google#apple
这其中包含了
# 指的是一个片段www.example.com/fruits.html#applewww.example.com/fruits.html#orange对应的情况是
如下为 JavaScript获取片段的示例代码
window.location.hash
基于上面的理解,www.example.com/fruits.html#apple和www.example.com/fruits.html#orange 会被搜索引擎当成一个链接。
如果不想被搜索引擎如上处理,有两种方式
www.example.com/fruits_apple.html和www.example.com/fruits_orange.html#!,即www.example.com/fruits.html#!apple和www.example.com/fruits.html#!orange 这种方式,可能只是Google 支持,其他搜索引擎待验证。