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 9159867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:35:53+00:00 2026-06-17T13:35:53+00:00

I try to retrieve the accept-language HTTP header value with jQuery in this way:

  • 0

I try to retrieve the “accept-language” HTTP header value with jQuery in this way:

$(document).ready(function () {
    //Ask ASP.NET what culture we prefer, because we stuck it in a meta tag
    var data = $("meta[name='accept-language']").attr("content")
});

Extracted from here.

The HTTP header is present because I can see it with the Chrome Network console tab "Accept-Language:en-US,en;q=0.8,de;q=0.6,es;q=0.4", but I always get undefined value.

Any idea?

  • 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-06-17T13:35:54+00:00Added an answer on June 17, 2026 at 1:35 pm

    You need to notice, that this code is not retrieving the actual header, but value which has been put into META tag (JavaScript doesn’t have access to the headers of original request). In the article you have linked you have this helper:

    namespace System.Web.Mvc
    {
        public static class LocalizationHelpers
        {
            public static IHtmlString MetaAcceptLanguage<T>(this HtmlHelper<T> html)
            {
                var acceptLanguage = HttpUtility.HtmlAttributeEncode(Threading.Thread.CurrentThread.CurrentUICulture.ToString());
                return new HtmlString(String.Format("<META name=\ content=\ {0}\?? accept-language\??>",acceptLanguage));
            }
        }
    } 
    

    Which you need to add to your project, and then use in view like this:

    <HTML>
        <HEAD>
            ...
            @Html.MetaAcceptLanguage()
        </HEAD>
        ...
    </HTML> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to retrieve this page using Apache HttpClient: http://quick-dish.tablespoon.com/ Unfortunately, when I try
I am currently try to retrieve a latitude and longitude value from a location.
I try to retrieve a variable value of a div (height) in order to
I try to retrieve a array from one table What is wrong with this
I am adding string[] into Arraylist, But when i try to retrieve value from
I try to retrieve a JSON object with jQuery from a server. Some properties
i try to retrieve value of dropdownlist value but it prints undefined why ?
Try yourself : as example, try to retrieve the fields of this video :
I try to retrieve a list of the attribute values of the children of
I am using mysqli to try and retrieve the teacher's username and then insert

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.