Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1104283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:27:42+00:00 2026-05-17T01:27:42+00:00

Is it possible to send an xhr HTTP HEAD request to only get header

  • 0

Is it possible to send an xhr HTTP HEAD request to only get header response for the first request and not automatically follow 301, 302 like redirects? I’m only interested in getting the new location of the url. Example:

var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(data) {
    if (xhr.readyState == 4) {
        if (xhr.status == 301 || xhr.status == 302) {
            // Get new location url don't GET it
        }
    }
};
xhr.open('HEAD', url, true);
xhr.send();

http://www.w3.org/TR/XMLHttpRequest/#infrastructure-for-the-send-method seems to specify that requests should be followed, is there a way to stop this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:27:42+00:00Added an answer on May 17, 2026 at 1:27 am

    There isn’t, this isn’t exposed behavior you can stop.

    It’s because of the spec you linked already, the specified behavior is that XmlHttpRequest should transparently follow redirects…under the covers unfortunately, and not in a way you can prevent.

    It’s this way to try and make things easier, if resources move, etc…but when it was designed and the spec laid out, all these redirection services weren’t out there. There just wasn’t a strong need for any other behavior or ability to prevent it, I think with as many redirects hitting the web not we’ll see the ability added, but who knows when every browser would support it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know if its possible to send out custom http REQUEST headers in
I'm trying to send a request that requires HTTP Digest authentication. Is Digest possible
Is it possible to send an intent only to one service when this one
Is it possible to send 100 Continue HTTP status code, and then later some
Is it possible to send GET, POST, PUT and DELETE requests from iPhone ||
Is it possible to send attributes in a SAML authentication request? <samlp:AuthnRequest xmlns:samlp=urn:oasis:names:tc:SAML:2.0:protocol xmlns:saml=urn:oasis:names:tc:SAML:2.0:assertion
Is it possible to send custom HTML messages to users when they first start
I'm not awfully knowledgeable about HTTP, but my understanding is that an HTTP request
Is possible to send data to browser multiple times per request? For example my
Is it possible to send a parameter (eg. a get variable) with getJSON to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.