如何在httpHandler中查找请求是针对js还是针对css
有没有什么办法可以找到httphandler中的特定请求是否是针对JS或CSS
来提高我的网站的性能我正在使用代码项目中的HttpCompress http://www.codeproject.com/KB/aspnet/httpcompression。 aspx?msg=2544100
但由于它结合了所有 js,它在很多地方破坏了我的 javascript...所以我想编写一个 httphandler,以便我能够提供压缩的 js 和 css。( < strong>我已经使用 YUICompressor 缩小了它们)。我知道这会导致多个 http 请求,但就我而言,我有一个截止日期,所以不想结合 javascript 和 css。
那么有什么方法可以做到这一点吗?
我还在压缩模块的源代码中看到,它们检查文件是否已经在浏览器上并发送 304 Not Modified 响应标头,但这对我来说有点令人困惑,所以任何人都可以破解它至于如果我想做同样的事情如何继续......
我不想要完整的答案,只需简单的指针就可以......
非常感谢
PS 我在共享主机上并且无法访问 IIS
is there any way to find if a particular request is for JS or CSS in httphandler
to improve the performance of my website i was using HttpCompress from Code Project
http://www.codeproject.com/KB/aspnet/httpcompression.aspx?msg=2544100
but since it is combining all the js it is breaking my javascript in many places...so i want to write a httphandler so that iwould be able to serve the js and css compressed.( i have already minified them using YUICompressor). i know this will cause multiple http request but in my case i have a deadline and so dont want combining of javascripts and css.
so any approach to do so???????
also i have seen in the source codes of compression module that they check if the file is already on the browser and send a 304 Not Modified response header but it is a little confusing to me so can anyone break it down as to how to proceed if i want to do the same....
i do not want whole answer just simple pointers would do...
thanks a lot
P.S i am on shared hosting and do not have access to IIS
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 HttpCompress 的示例配置文件中,它们提供了两个用于排除文件被压缩的选项:按 MIME 类型排除和按路径排除。
以下配置文件假定您的服务器将 javascript 作为文本/javascript 提供服务(在设置之前您应该仔细检查)。
In the example config file for HttpCompress they give two options for excluding files from being compressed: Exclusion by MIME type and Exclusion by path.
The following config file presumes that your server is serving javascript as text/javascript (something you should double check before setting).