开发者

Is there some way to intercept and modify the html output stream in asp.net, to combine the javascript?

Is there some way to intercept the HTML output stream in asp.net and make modifications? Eg using httpmodules or something? I know this is possible using java servlets and assume there must be an elegant way to do this with asp.net.

My purpose is to combine the many javascript files into one composite script which has been minified/packed, to make the page load faster.

Eg, if my page normally outputs the following in the page head:

<script type="text/javascript" src="/scripts/blah.js"></script> 
<script type="text/javascript" src="/scripts/yada.js"></script> 

I want to replace that with the following:

<script type="text/javascript" src="/scripts/all.js"></script> 

(also i realise i'l开发者_如何学Pythonl have to create all.js somehow). Thanks!


You can set Response.Filter.


Here is an interesting article. I haven't tried this, just did a search.

I know that Telerik does something similar for their controls.

http://geekswithblogs.net/rashid/archive/2007/07/25/Combine-Multiple-JavaScript-and-CSS-Files-and-Remove-Overheads.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜