避免饼干同时要求静态内容 [英] Avoiding cookies while requesting static content

查看:130
本文介绍了避免饼干同时要求静态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是做了我的Web应用程序页面中的一个(使用ASP.Net开发服务器上运行内置)使用谷歌Chrome的开发者工具的审计。一个特别的警告引起了我的眼睛:

I just did an audit of one of my web application page (built using ASP.Net and running on development server) using Google chrome's developer tool. One particular warning caught my eyes:

从Cookie的域提供静态内容(5)

下面是我的屏幕截图( http://yfrog.com/7eauditresultp )为好。我想知道的是有可能避免的cookie这类请求。我看到有对JavaScript文件中没有cookie的请求为好。我能够避免在头饼干的这些文件以及?为什么没有浏览器的cookies附加的JavaScript文件,并附加了CSS和图像?

Here is my screen shot (http://yfrog.com/7eauditresultp) as well. I would like to know is it possible to avoid cookies for these kind of requests. I see that there is no cookie requests for javascript files as well. I it possible to avoid cookies in the header for these files as well? and why didn't the browser attach cookies for javascript files and attach for CSS and image?

有什么想法和建议,欢迎

Any thoughts and suggestions are welcome

推荐答案

曲奇被附加到域和路径。如果上面的文件的路径设置cookie,他们会为这些文件的任何请求被发送。

Cookie are "attached" to a domain and a path. If you set cookies for a path above your files, they'll be sent with any request for those files.

警告消息本身会告诉你如何解决这个问题 - 使用另一个域的静态内容。或者一个子域,只要你一定要保持你的主要领域无Cookie在这种情况下。

The warning message itself tells you how to fix this - use another domain for your static content. Or a subdomain, as long as you make sure you keep your main domain cookieless in that case.

这篇关于避免饼干同时要求静态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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