Reputation: 23181
I'm using Fiddler to inject a javascript library like so:
if( oSession.HostnameIs("www.mysite.com") )
{
oSession.utilReplaceInResponse('</head>','<script src="//myLibrary.js"></script></head>');
}
This works by prepending my script to the closing </head>
.
I've noticed that this will also inject it in any iframes on the page, but would like to prevent this.
question: Is there a way to do this while excluding iframes within Fiddler's customRules.js file?
Note, I will not know what site will be loaded in these iframes, so a generic solution is needed.
Thanks!
Upvotes: 0
Views: 477
Reputation: 57085
You're asking: "Can a proxy know whether or not a given request is for a top-level frame or for an iframe?"
The answer is basically "no." If you set the X-Download-Initiator
option in IE (see http://blogs.msdn.com/b/fiddler/archive/2011/02/10/fiddler-is-better-with-internet-explorer-9.aspx) you can get some awareness, but this only works in IE and you shouldn't set this option except on your own computer.
Upvotes: 2