61

How do I POST to a web page using Firebug?

Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121
Guy
  • 59,547
  • 93
  • 241
  • 306

10 Answers10

41

You can send POST request to any page by opening console (e.g. in FireFox ctrl + shift + k) and typing simple JS:

var formPost = document.createElement('form');
formPost.method = 'POST';
formPost.action = 'https://www.google.com'; //or any location you want
document.body.appendChild(formPost);
formPost.submit();
Marko Vranjkovic
  • 4,997
  • 4
  • 38
  • 60
  • Nice one. Requires neither jQuery nor a pre-existing form. – chris Sep 13 '13 at 12:13
  • 4
    Got to love this answer, as it works with almost any browser. One tip to make this even better is that you need to `createElement('input')`, set its `value` and add it to your `formPost` with `appendChild`. – RibeiroBreno Mar 23 '15 at 06:11
37

AFAIK Firebug can't do this. However, there is a very useful Firefox extension, in the spirit of Firebug, called Tamper Data. This should be able to do what you want.

It allows you to monitor each request made by the browser, and you can turn on an option that allows you to look at, and edit, every single request before it gets sent.

Mike Cooper
  • 2,617
  • 2
  • 23
  • 29
  • Sick, thanks for the tip. Had been using Poster, but it sucks – thesmart Aug 04 '09 at 22:18
  • 1
    hm, I didn't see a way to Post through Tamper Data. – Bozho May 26 '11 at 08:12
  • @Bozho, took me a bit to figure out as well. You have to Start Tamper, then request or refresh your page. – Dustin Jul 20 '11 at 17:30
  • 5
    Info from the future: you *can* make an XHR POST since Firefox 3.5: http://stackoverflow.com/a/11604647/245966 – jakub.g Feb 28 '13 at 11:01
  • @thesmart Poster's alright for simple stuff, but if there are a lot of moving parts or weird formats I'd tend to agree with you. Modding packets in firebug is a way nicer option... – root Aug 05 '13 at 01:37
22

Firefox 27 (maybe earlier versions too, never checked) has built-in developer tools to modify and resend requests. If you don't have Firebug installed, the console is available by pressing the F12 key. If Firebug is installed, press Ctrl+Shift+K instead.

enter image description here

Mike P
  • 700
  • 12
  • 23
Piotr Kochański
  • 19,970
  • 6
  • 67
  • 75
  • 1
    Best answer for my case. I was aware of the other extensions like Tamper Data but i really wanted to do this without adding another one here and i already have Firebug. Just don't forget to change content type to `application/x-www-form-urlencoded` if you're doing a standard POST request. – RibeiroBreno Mar 23 '15 at 06:05
  • Best answer for me. No need for extra plugin and very simple way to tweak post/get requests. – EmmanuelC Nov 25 '16 at 10:09
13

I know this is an old question, but I recently stumbled upon the same problem and wanted to share the method I am using.

Assuming the web site you want to POST to has a form with method="POST" (a very likely scenario), you can use Firebug's JavaScript command line to programmatically submit a POST request. Just click the "Show Command Line" icon in Firebug and enter something like this in the narrow text box at the very bottom of the window:

    document.forms[0].submit()

Maybe this helps someone.

chris
  • 2,089
  • 1
  • 20
  • 30
  • BTW, if the page happens to use jQuery, you don't even need a form, you can use the jQuery AJAX API to build a POST request on the fly in the Firebug JS console. See http://api.jquery.com/jQuery.post/ – chris Jan 15 '13 at 10:04
6

Another simple solution is to load any webpage that uses jQuery, and type up a $.post() in the console.

Joe
  • 61
  • 1
  • 1
4

HTTP resource test is a firefox plugin that can do this.

Bozho
  • 554,002
  • 136
  • 1,025
  • 1,121
1

Another powerful Firefox plugin to perform post request and some more features is the Hackbar.

oopbase
  • 10,431
  • 12
  • 37
  • 59
1

Related: To resend a POST already made, right click the POST request in the Net/XHR view and click "Resend".

Using Firebug 1.12.0:

Murrah
  • 1,103
  • 1
  • 10
  • 17
0

Got here looking for a Firebug way of doing this. Then I realized that I could use Fiddler. This is the most powerful tool I know when it comes to debugging web requests.

Fiddler The free web debugging proxy for any browser, system or platform

Click the Composer tab and write your request as desired - then click Execute.

Leniel Maccaferri
  • 94,281
  • 40
  • 348
  • 451
0

NO NEED of plugins !!

Just drag any url in BOOKMARK BAR, then right click and EDIT, and insert javascript code:

enter image description here

javascript:var my_params=prompt("Enter your parameters","var1=aaaa&var2=bbbbb"); var Target_LINK=prompt("Enter destination", location.href); function post(path, params) {   var form = document.createElement("form");   form.setAttribute("method", "post");   form.setAttribute("action", path);   for(var key in params) {  if(params.hasOwnProperty(key)) {        var hiddenField = document.createElement("input");      hiddenField.setAttribute("name", key);      hiddenField.setAttribute("value", params[key]);         form.appendChild(hiddenField);  }   }   document.body.appendChild(form);  form.submit(); }   parsed_params={}; my_params.substr(1).split("&").forEach(function(item) {var s = item.split("="), k=s[0], v=s[1]; parsed_params[k] = v;}); post(Target_LINK, parsed_params); void(0); 

then enter the target site-link, and click that button in BOOKMARK BAR! That's all!





( source: https://stackoverflow.com/a/38643171/2377343 )

Community
  • 1
  • 1
T.Todua
  • 44,747
  • 17
  • 195
  • 185