3

I have tried using jQuery.i18n.properties({}); plugin from this reference site but it's not working.

Is there any another way to read properties file in JavaScript or jQuery so that the contents can be loaded on an HTML page?

4
  • 1
    Is the access attempt cross-domain? Is it for a http:/https: resource or for a file:// resource? Do you see any errors in your JavaScript console? Please post a sample of your code. Commented Aug 26, 2013 at 18:23
  • yes its http:// as i am trying to read the property file using localhost i.e IIS server and on console its showing 404 [file not found] but i have checked the throughtly the path is perfect Commented Aug 26, 2013 at 18:32
  • 1
    Just so we're clear: have you looked in your network console and verified that the Ajax request produced by the plugin is a request for a resource on the exact correct path? That is, if you copy the URL directly out of your browser's network console (for example, in chrome, find your network console with F12 and go to the "Network" tab) and paste it into your address bar, it works? Commented Aug 26, 2013 at 18:56
  • 1
    Failed to load resource: the server responded with a status of 404 (Not Found) localhost/test/bundle/Messages.properties?_=1377629072062 It show this ERROR but the path to the file is correct one And when i copy and paste the url under the network tab i get "HTTP Error 404.3 - Not Found" Commented Aug 27, 2013 at 18:45

2 Answers 2

1

I think including MIME type to IIS will work

Add

'.properties' MIME extension and add type 'text/plain'.

Sign up to request clarification or add additional context in comments.

Comments

0

Specifically (see previous answer) you can do that in two ways:

1) web.config (recommended) - add the following 2 elements :

<configuration>
...
   <system.webServer>
   ...
      <staticContent>
      ...
         <remove fileExtension="properties" />
         <mimeMap fileExtension="properties" mimeType="text/plain" />

2) IIS - you need to do that every time you deploy to a new IIS

  • open IIS manager
  • select either the machine node or the web site node (usually Default Web Site)
  • In the Features View - locate the "Mime Types" icon under the IIS section.
  • add the mime type:
    • File name extension: ".properties" (make sure you have the dot at the beginning)
    • Mime type: "text/plain"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.