views:

55

answers:

2

I am trying to make a bookmarklet, which will be used only in Firefox 3. I want it to do one thing if the page it is used on was the result of a GET request, and another thing if it was produced after submitting a POST request. Specifically, I am trying to determine whether I can pull up the same page by accessing the URL that is in the address bar. Something like this:

if (whatever) {
    alert("This page was produced by a get request.");
} else {
    alert("This page was produced by a post request.");
}

I just need to know how to test for it.

A: 

I'm pretty sure javascript can't detect what HTTP verb was used.

Spencer Ruport
+1  A: 

I don't know of a way for you to do this as a bookmarklet, but there is a Firefox addin that can give you this information - http://livehttpheaders.mozdev.org/ You could take a look at the source of that add-in and see if you can modify it to create your own add-in to do what you want based off of their code.

garethm
Thank you. I don't know much about Firefox add-ons, but I may try this if I find the time and willingness to experiment.
mikez302