Scan page for javascript + CSS links/code and put in handler RRS feed

  • Question

  • User1840381093 posted


    would it be possible to scan the entire page (maybe on prerender event) to gather all the javascript + css resources linked or added to the code and then put them in 1 file and deliver either through a httphandler or a dynamic file?

    Background: I'm using a 3rd party controls solution (Syncfusion) that does not support combining it's javascript resources. They would pop up all over the page in the <head> and <body> tag and I need to combine them to reduce http requests.

    Thanks for any pointers!


    Tuesday, February 7, 2012 2:59 AM


  • User83408008 posted

    yes its possible

    I made a handler that ready the whole HTML output in an XmlDocument object and then just grab all script / css tags to combine them

    The best way is to screate a class that derives from Stream

    Then replace the filter value on the Handler with your custom stream.

    Now just check for the content of the file, buffer it in your module and do text manipulations as you see fit

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 10, 2012 7:03 AM