Getting Culture Information through Javascript

.net , , java , javascript , xhtml Ambāla, India
  • 13 years ago

    Hi All

    I am developing one web application in which I have used the localization concept introduced in .net 2.0

    I am dispalying my UI based on the client culture.Now I want the information regarding the browser at client side as I can able to know about the language of client browser. And Hence I will be able to show the UI culture specific as to client browser.

    But I am not finding anything which can give me browser language information (example: if English en-US) through JAVA SCRIPT I have used navigator but it is not working with IE 6.0 & above Considering user is using IE I have to find another way

    Please help remember it all I want to do in JAVA SCRIPT     

    Thanks in advance



  • 13 years ago


    When i want to get some server data into a javascript function, i tend to stick with using a client callback, the javascipt function can call a server side function without causing a full postback and have the UICulture returned to it in a string.

    That way, regardless of browser, you should be able to get the result you want.

    Let me know if you need help with it.


  • 13 years ago

    HI Slicksim

    Sorry I didn't get you actally wht I want is like google when you open google it checks the UICulture of your computer and accordingly it displays the homepage.

    Also I am very much intrested in knowing your concept.

    Pls give me any info. you have

    takecare Bye


  • 13 years ago


    I wanted to attach a zip file with a mini project for you to use, but it seems i can't.

    Here are the contents of the two files i have used, sorry it is VB.Net, i don't do C#.

    This is the .aspx page

    <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "">
    <html xmlns="">
    <head runat="server">
        <title>Untitled Page</title>
        <script type="text/javascript" language="javascript">
            function Culture(cult)
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />

    This is the aspx.vb file

    Partial Class _Default
        Inherits System.Web.UI.Page
        Implements ICallbackEventHandler

        Public Function GetCallbackResult() As String Implements System.Web.UI.ICallbackEventHandler.GetCallbackResult
            Return Threading.Thread.CurrentThread.CurrentUICulture.Name
        End Function

        Public Sub RaiseCallbackEvent(ByVal eventArgument As String) Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

        End Sub

        Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
            Page.ClientScript.RegisterStartupScript(Me.GetType, "getculture", "<script  type='text/javascript' language='javascript'>" & ClientScript.GetCallbackEventReference(Me, "", "Culture", "") & " ;</script>")
        End Sub
    End Class

    Hopefully that will help you out.  if you need it explaining, just let me know.

    Simon C

  • 11 years ago


    The following command can help you.

    this.clientInformation {...} appCodeName: "LTMM" appMinorVersion: "0" appName: "Microsoft Internet Explorer" appVersion: "" browserLanguage: "en-us" connectionSpeed: {???} cookieEnabled: true cpuClass: "x86" mimeTypes: {...} onLine: true opsProfile: null platform: "Win32" plugins: {...} systemLanguage: "en-us" userAgent: "LTMM" userLanguage: "en-us"

    Kishor Rudra

  • 11 years ago


    The following command can help you.


    Kishor Rudra

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“My definition of an expert in any field is a person who knows enough about what's really going on to be scared.” - P. J. Plauger