有个需求,记录请求来源,运营同学会以 https://www.guanwang.com/index#baidu 的形式来区分推广渠道。
后台拿到的链接是 [https://www.guanwang.com/index](https://www.guanwang.com/index), #baidu 不是有效的链接。
方案是,前端拿到此完整链接,再向后台发请求。

a 标签

#baidu 是标签,浏览器打开时会实现自动定位到锚点的效果。

  1. <li><a class="reference internal" href="#">Configuring NGINX Plus as a Web Server</a><ul>
  2. <li><a class="reference internal" href="#setting-up-virtual-servers">Setting Up Virtual Servers</a></li>
  3. <li><a class="reference internal" href="#configuring-locations">Configuring Locations</a></li>
  4. <li><a class="reference internal" href="#using-variables">Using Variables</a></li>
  5. <li><a class="reference internal" href="#returning-specific-status-codes">Returning Specific Status Codes</a></li>
  6. <li><a class="reference internal" href="#rewriting-uris-in-requests">Rewriting URIs in Requests</a></li>
  7. <li><a class="reference internal" href="#rewriting-http-responses">Rewriting HTTP Responses</a></li>
  8. <li><a class="reference internal" href="#handling-errors">Handling Errors</a></li>

打开此链接,查看效果:

  1. https://docs.nginx.com/nginx/admin-guide/web-server/web-server/#setting-up-virtual-servers