简体   繁体   English

当从另一个域中单击“后退”按钮时,浏览器是否会重新加载页面?

[英]Does a browser reload a page when `back` button is clicked from another domain

Suppose, a user hits mydomain.com . 假设某个用户点击了mydomain.com The history stack now contains one entry. 现在,历史记录堆栈包含一个条目。 Then user clicks a link on my website to mydomain.com/cool and I push another state. 然后,用户单击我网站上的指向mydomain.com/cool的链接,然后推送另一个状态。 Now the history stack contains two entries with mydomain.com/cool being the last one. 现在,历史记录堆栈包含两个条目,其中mydomain.com/cool是最后一个条目。 Now a user goes to google.com - what happens to the history stack? 现在,用户转到google.com历史记录堆栈会怎样?

Does google.com is put by browser on top of my two entries? 浏览器是否将google.com放在我的两个条目的顶部? Is history stack tab specific? 历史记录堆栈选项卡是否特定?

And when the user presses back button, will the browser send request to the server to mydomain.com/cool ? 当用户按下“后退”按钮时,浏览器是否会将请求发送到服务器到mydomain.com/cool

Now a user goes to google.com - what happens to the history stack? 现在,用户转到google.com-历史记录堆栈会怎样?
Does google.com is put by browser on top of my two entries? 浏览器是否将google.com放在我的两个条目的顶部?

Yes, the history stack contains now google.com , mydomain.com/cool and mydomain.com in this order. 是的,历史记录堆栈现在按此顺序包含google.commydomain.com/coolmydomain.com

Is history stack tab specific? 历史记录堆栈选项卡是否特定?

It is tab specific. 它是选项卡特定的。 In some browsers (expecially mobile ones, where tabs are often not visible on the top of the screen), History stack is tab specific until you reach the "entry point" of the current tab. 在某些浏览器中(尤其是移动浏览器,其中选项卡通常在屏幕顶部不可见),“历史记录”堆栈是特定于选项卡的,直到您到达当前选项卡的“入口”。 So if from google.com you open in another tab google.com/some_external_link , pressing back you will go magically back to the previous tab. 因此,如果您从google.com打开另一个标签google.com/some_external_link ,请按回去,即可神奇地返回上一个标签。

And when the user presses back button, will the browser send request to the server to mydomain.com/cool ? 当用户按下“后退”按钮时,浏览器是否会将请求发送到服务器到mydomain.com/cool?

It depends. 这取决于。 Maybe the browser could retrieve the page from the cache. 也许浏览器可以从缓存中检索页面。 This happens expecially when you have a static content (without query parameter such as ?page=2 ). 当您拥有静态内容(没有诸如?page=2类的查询参数)时,这种情况特别发生。 But you should test browser behaviour in this case. 但是在这种情况下,您应该测试浏览器的行为。

The history stack is tab specific. 历史记录堆栈是选项卡特定的。 it will contain list of urls in order of visit in that tab 它会在该选项卡中按访问顺序包含网址列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM