How to write a Firefox plugin that intercepts certain HTTP requests
Asked Answered
N

2

9

Is there a way to make a Firefox plugin intercept certain requests and respond to them without hitting the network?

Example: every time the browser is about to request http://www.example.com/page.html, the plugin automatically returns "Hello world!" for that page.

Cheers!

Neighborly answered 4/11, 2009 at 14:21 Comment(3)
Clarification: I need to programatically intercept and respond to certain http requests, without the http request ever going to the network.Neighborly
Check out the answer which proposed Fiddler. It matches your needs and it's an advanced tool.Manual
did you find a solution? i want to do the same...Surfeit
B
6

Tamper Data is a good one.

Use tamperdata to view and modify HTTP/HTTPS headers and post parameters.

Security test web applications by modifying POST parameters.

You can checkout tamper data sources and see how the extension works in mozdev and borrow some ideas, or get in touch with the author in adamsplugins [AT] gmail {DOT} com.

I don't know if it's exactly what you're looking for, but it's really powerful. I use it a lot with Firebug, so you can edit your pages on the fly and test for some behaviors.

Benildis answered 4/11, 2009 at 14:30 Comment(3)
This is a plugin - I need to know how to write a plugin that does something similar. If you know where the tamper source code is, that would be awesome!Neighborly
in tamper data u still hit the server, if u want to edit the response use fiddler, an external proxyManual
Tamper Data link is brokenLipinski
D
0

You could craft an extension that "rewrites" the anchor elements and inserts the javascript you need.

I am pretty sure you can do this with a Greasemonkey script but it's been a while. I know you can definitely do this on Chrome.

Diaconal answered 4/11, 2009 at 14:23 Comment(1)
I actually need to modify the http traffic, and intercept certain requests without the request going to the serverNeighborly

© 2022 - 2024 — McMap. All rights reserved.