开发者

jquery.localize doesnt work

i have followed instructions found on https://github.com/coderifous/jquery-localize, and for testing purpose i have created this test file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Test</title>
    <script src="jquery-1.6.1.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="jquery.localize.js" type="text/javascript" charset="utf-8"></script>
  </head>

  <body>
    <p rel="localize[greeting]">some text</p> 
    <script type="text/javascript" charset="utf-8">
      $(function(){
        $("[rel*=localize]").localize("test", "en")
      })
    </script>
  </body>
</html>
开发者_开发技巧

and test-en.json

{ "greeting": "welcome stranger.." }

locally it is working with IE8 and Firefox, but with chrome it is not working. what i get is an error in console log: XMLHttpRequest cannot load file:///C:/../test/examples/test-en.json. Origin null is not allowed by Access-Control-Allow-Origin.

how can i set it up correctly? are they any incompqtibilites with jquery 1.6.. or web browsers?

thanks


XMLHttpRequest cannot load file:///C:/../test/examples/test-en.json. Origin null is not allowed by Access-Control-Allow-Origin.

Sounds like you are running off your local harddrive. You really should be running a local server to test the files. Easy thing to run is apache or IIS [if on windows].

If you do not want to run a local server, you can set the flag in chrome to allow it --allow-file-access-from-files

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜