Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I send a HEAD request manually using Firefox?

I'm debugging my webserver, and I'd like to manually send HEAD requests to some web pages. Is there a way to do this in Firefox? Some extension perhaps.

I want to use firefox so that it can be part of a normal session (ie cookies set, logged in, etc). So things like curl aren't perfect.

like image 732
Paul Biggar Avatar asked Dec 29 '09 19:12

Paul Biggar


People also ask

How do I request a header in Firefox?

This frame has a header tab whose frame allows you to modify the header by clicking the Edit and Resend button. Click that button and then add the additional needed header params. then click the resend button.

How do you send a HEAD request?

To send a HEAD request using Curl, you must pass the --head (-I) parameter to the Curl call. An alternative way to send a HEAD request using Curl is to pass the -X HEAD command-line argument instead of -I. Please note that some servers may reject HEAD requests but still respond to GET requests.

Do browsers make HEAD requests?

A browser will send a HEAD request if that is explicitly requested in an XMLHttpRequest , but I'm fairly certain that the browser will never send a HEAD request of its own accord.

How do I make HTTP request in browser?

To make an HTTP call in Ajax, you need to initialize a new XMLHttpRequest() method, specify the URL endpoint and HTTP method (in this case GET). Finally, we use the open() method to tie the HTTP method and URL endpoint together and call the send() method to fire off the request.


1 Answers

Another possiblity is opening up firebug (or making this into a greasemonkey script) and using javascript to send your HEAD request.

// Added comments
 var xmlhttp = new XmlHttpRequest(); 
 xmlhttp.open("HEAD", "/test/this/page.php",true); // Make async HEAD request (must be a relative path to avoid cross-domain restrictions)
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) { // make sure the request is complete
   alert(xmlhttp.getAllResponseHeaders()) // display the headers
  }
 }
 xmlhttp.send(null); // send request

XmlHttpRequests inherit the cookies and current session (authentication from .htaccess etc).

Way to use this:

  • Use the javascript: url method
  • Use the Firebug console (http://getfirebug.com/) to execute javascript on the page
  • Create a greasemonkey script that executes HEAD requests and displays the result
like image 175
Christopher Tarquini Avatar answered Sep 18 '22 15:09

Christopher Tarquini