为什么 Twitter 在 URL 中使用哈希和感叹号,他们如何重写搜索 URL? [英] Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs?

查看:16
本文介绍了为什么 Twitter 在 URL 中使用哈希和感叹号,他们如何重写搜索 URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们知道哈希是用于 AJAX 搜索的,但是感叹号呢?有人知道吗?

We understand the hash is for AJAX searches, but the exclamation mark? Anyone know?

此外,他们搜索表单的action"属性指向/search",但是当您进行搜索时,URL 中会出现哈希感叹号.他们只是从/search"重定向到/#!/search"?

Also, the "action" attribute for their search form points to "/search," but when you conduct a search, the hash exclamation mark appears in the URL. Are they simply redirecting from "/search" to "/#!/search"?

注意: q 的第二部分仍未回答:也就是说,他们是将用户从/search"重定向到/#!/search",还是将用户发送到/search"并在页面上使用JS重写URL?– Crashalot 1 月 26 日 23:51

Note: the second part of the q remains unanswered: That is, are they redirecting the user from "/search" to "/#!/search", or do they send the user to "/search" and use JS on the page to rewrite the URL? – Crashalot Jan 26 at 23:51

谢谢!

推荐答案

然后回答第二部分:它将您重定向到/#!/search.

To answer the second part then: It is redirecting you to /#!/search.

如果您在访问 http://twitter.com/britishdev(插件插件) 返回 302(临时重定向),位置标头设置为位置:http://twitter.com/#!/britishdev"

If you look at the response headers when going to http://twitter.com/britishdev (plug plug) you are returned a 302 (temporary redirect) with the Location header set as "Location: http://twitter.com/#!/britishdev"

是的,JavaScript 会在目标页面上提取您的所有详细信息,但无论您重定向到何处.

Yes JavaScript is then pulling all your detail in on the destination page but regardless that is where you are redirected to.

这篇关于为什么 Twitter 在 URL 中使用哈希和感叹号,他们如何重写搜索 URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆