URL 是我们进行网络活动中很重要的概念,一个URL中可以包含域名,路径和参数等,
https://www.example.com/fruits.html?from=google#apple
这其中包含了
#
指的是一个片段www.example.com/fruits.html#apple
www.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 支持,其他搜索引擎待验证。扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有