开发者

Post/Redirect/Get in Webkit causes a full page reload

开发者 https://www.devze.com 2023-01-04 21:26 出处:网络
It seems that in Webkit-based browsers (Chrome and Safari) when a Post/Redirect/Get is performed on the server, the entire page (html + images + css, etc.) is redownloaded. It appears the same as if y

It seems that in Webkit-based browsers (Chrome and Safari) when a Post/Redirect/Get is performed on the server, the entire page (html + images + css, etc.) is redownloaded. It appears the same as if you reloaded the page.

There's been a question (and somewhat of a solution) posted in the Google Chrome Help: http://www.google.com/support/forum/p/Chrome/thread?tid=72bf3773f7e66d68&hl=en

Does anyone have a more elegant way of doing this? I'm working with ASP.NET MVC and would prefer to 开发者_开发技巧not write a custom Redirect result that returns Javascript or the actual page based on the UserAgent.

Should I just hope and wait that Webkit will change its behavior?


This is a bug. The only "workaround" I've seen untill now is to use a Refresh header instead of a Location header to do the redirecting. This is far from ideal.

Bug 38690 - Submitting a POST that leads to a server redirect causes all cached items to redownload

Also, this question is a duplicate of "Full page reload on Post/Redirect/Get ignoring cache control".


Try setting Cache-Control: public header.

0

精彩评论

暂无评论...
验证码 换一张
取 消