Skip to content

Instantly share code, notes, and snippets.

@hasegawayosuke
Last active August 17, 2020 05:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hasegawayosuke/cf2f7bcf641b90d0ee4e to your computer and use it in GitHub Desktop.
Save hasegawayosuke/cf2f7bcf641b90d0ee4e to your computer and use it in GitHub Desktop.
Hide CSS files of Fiddler tracif
// Open Fiddler and Choose "Rules" menu, click "Customize Rules..." and add this code to CustomRule.js
class Handlers
{
// ....
public static RulesOption("Hide CSS")
BindPref("fiddlerscript.rules.HideCSS")
var m_HideCSS: boolean = false;
// ....
static function OnBeforeResponse(oSession: Session) {
// ....
if (m_HideCSS && oSession.oResponse.headers.ExistsAndContains("Content-Type", "text/css") )
{
oSession["ui-hide"] = "true";
}
// ....
}
}
@huseyint
Copy link

And for JavaScript files:

class Handlers
{
    // ....
    public static RulesOption("Hide JavaScript")
    BindPref("fiddlerscript.rules.HideJS")
    var m_HideJS: boolean = false;
    // ....
    static function OnBeforeResponse(oSession: Session) {
        // ....
        if (m_HideJS && (oSession.oResponse.headers.ExistsAndContains("Content-Type", "text/javascript") || oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/x-javascript") || oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/javascript")))
        {
            oSession["ui-hide"] = "true";
        }
            // ....
    }
}

@heldersepu
Copy link

Great additions!
Both should be integrated into default Fiddler install ...

@poma
Copy link

poma commented May 22, 2016

You may also want to exclude ajax when filtering JS:

        if (m_HideJS && !oSession.oRequest.headers.ExistsAndContains("X-Requested-With", "XMLHttpRequest") && (oSession.oResponse.headers.ExistsAndContains("Content-Type", "text/javascript") || oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/x-javascript") || oSession.oResponse.headers.ExistsAndContains("Content-Type", "application/javascript")))
        {
            oSession["ui-hide"] = "true";
        }

maybe also add filter for .js file extensions since some websites may include static js files with ajax

@brucmao
Copy link

brucmao commented Aug 17, 2020

image
How can I hide the 304 ?
I use the Hide 304s and Hide Not Modified(304) not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment