问题描述
我搜索这个问题的网站,但我发现没有什么:
I searched the Web about this question but I found nothing:
什么是后退按钮的逻辑是什么?当我们打的Web浏览器的后退按钮发生了什么?
What is the logic of the back button? What is happening when we hit the back button on a Web browser?
我真的想了解更多关于这一点。
I really would like to understand more about that.
感谢您。
推荐答案
您的网页浏览器保持一个堆栈(或列表,如果你愿意)。比方说,你的主页是google.com,并从那里你访问其他一些网站:youtube.com,yahoo.com和cnn.com。在参观最后一个,列表如下:
Your web browser keeps a stack (or list, if you will) of the web pages that you have visited in that window. Let's say your home page is google.com and from there you visit a few other websites: youtube.com, yahoo.com, and cnn.com. Upon visiting the last one, the list looks like this:
google.com -> youtube.com -> yahoo.com -> cnn.com
^
|
current page
在preSS后退按钮,浏览器将带你回到previous页面列表中,像这样的:
When you press the Back button, the browser takes you back to the previous page in the list, like this:
google.com -> youtube.com -> yahoo.com -> cnn.com
^
|
current page
在这一点上,你可以再次preSS返回带你到youtube.com,或者你可以preSS着再次让你在cnn.com。比方说,你preSS返回第二次:
At this point you can press Back again to take you to youtube.com, or you can press Forward to put you at cnn.com again. Let's say you press Back a second time:
google.com -> youtube.com -> yahoo.com -> cnn.com
^
|
current page
如果你现在去,说,abc.com,名单变化如下:
If you now go to, say, abc.com, the list changes to look like this:
google.com -> youtube.com -> abc.com
^
|
current page
请注意,这两个yahoo.com或cnn.com从列表中消失。这是因为你采取了新的途径。该浏览器仅保留列表中,您访问了去你现在在哪里,而不是每一个你曾经去过页面历史页面。该浏览器也不会知道你正在访问的网站,这可能会导致一些令人吃惊的行为的任何结构。
Note that both yahoo.com and cnn.com are gone from the list. This is because you took a new route. The browser only maintains a list the pages you visited to get to where you are now, not a history of every page you've ever been to. The browser also doesn't know anything about the structure of the site you're visiting, which can lead to some surprising behavior.
您是在购物网站上(ne.com,作为一个简单的例子),有类别和产品子类地浏览。该网站设计人员提供了周到靠近窗口的顶部,让您通过浏览类别。你开始在网站的首页,点击硬件,然后记忆。列表现在看起来是这样的:
You're on a shopping site (ne.com, as a short example) that has categories and subcategories of products to browse through. The site designer has thoughtfully provided breadcrumbs near the top of the window to allow you to navigate through the categories. You start at the top page of the site, click on Hardware, then Memory. The list now looks like this:
google.com -> ne.com -> ne.com/hw -> ne.com/hw/mem
^
|
current page
您想回到五金类,让你用面包屑上去父类,而不是使用后退按钮。现在,浏览器列表如下:
You want to go back to the Hardware category, so you use the breadcrumbs to go up to the parent category instead of using the Back button. Now the browser list looks like this:
google.com -> ne.com -> ne.com/hw -> ne.com/hw/mem -> ne.com/hw
^
|
current page
根据该网站的结构,你去退(一个级别),但到浏览器,你走上前去,因为你点击一个链接。您单击地址栏中的URL链接或类型,在任何时候,你是前进至于浏览器而言,该链路是否需要你,你已经去过一个页面。
According to the site structure, you went backward (up a level), but to the browser you went forward because you clicked on a link. Any time you click on a link or type in a URL in the address bar, you are going forward as far as the browser is concerned, whether or not that link takes you to a page that you've already been to.
最后,要返回到主网站页面(ne.com)。您可以使用面包屑,但这次您单击后退按钮 - 这似乎是显而易见的,它应该带你上一个层次,对不对?但是,在没有考虑你?
Finally, you want to return to the main site page (ne.com). You could use the breadcrumbs, but this time you click the Back button -- it seems obvious that it should take you up one level, right? But where does it take you?
这是最初迷惑很多用户(包括我自己,当我碰巧做的正是这一点),它需要你下降的水平,回到记忆类别。纵观页面列表,很容易明白为什么:
It's initially confusing to many users (myself included, when I happen to do exactly this) that it takes you "down" a level, back to the Memory category. Looking at the list of pages, it's easy to see why:
google.com -> ne.com -> ne.com/hw -> ne.com/hw/mem -> ne.com/hw
^
|
current page
要回去仅使用后退按钮将需要两个presses主页,带你回的硬件类别,终于到了主页。这么看来明显地向我们的程序员是怎么回事,却惊喜的挫折感普通用户的所有的时间,因为他们没有意识到,浏览器不知道的任何网站,他们正好是在层次结构什么。
To go back to the main page using only the Back button would require two more presses, taking you "back" to the Hardware category and finally to the main page. It seems so obvious to us programmers what's going on, but it surprises the heck out of regular users all the time because they don't realize that the browser doesn't know anything about the hierarchical structure of whatever website they happen to be on.
难道是巨大的,如果浏览器将让站点设计编程后退按钮做明显的事情(接受你的水平),而不是不管它现在呢?
Would it be great if browsers would let site designers program the Back button to do the obvious thing (take you up a level) rather than whatever it does now?
编辑:一个评论者询问是否浏览器重新加载页面或简单地显示出来其本地缓存
A commenter asked whether the browser reloads the page or simply displays it out of its local cache.
答案是它依赖。网站设计者可以指定浏览器是否应缓存页面或没有。对于设置为页面非缓存,浏览器从您preSS后退,好像它是你访问过它第一次在服务器重新加载页面。缓存的网页,浏览器显示出来的缓存,这是更快的。
The answer is it depends. Site designers can specify whether the browser should cache the page or not. For pages that are set as non-cached, the browser reloads the page from the server when you press Back, as though it was the first time you are visiting it. For cached pages, the browser displays it out of the cache, which is much faster.
这篇关于如何在Web浏览器的后退按钮的工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!