开发者

jquery-include example that works with Firefox does not work with Chrome

开发者 https://www.devze.com 2023-02-14 22:17 出处:网络
None of my uses of jquery-include have worked with Chrome which has been during the last few months. Contents of x.html:

None of my uses of jquery-include have worked with Chrome which has been during the last few months.

Contents of x.html:

<!DOCTYPE html>
<head>
<script type="text/javascript"
  src="https://ajax.googleapis开发者_JS百科.com/ajax/libs/jquery/1.5.1/jquery.js"></script>
<script type="text/javascript" src="jquery.include-2.3.js"></script>
</head>
<body>
<p>Contents of stuff.html: <span src="stuff.html"></span>.</p>
</body>
</html>

Contents of stuff.html:

STUFF

For x.html the result is as expected with Firefox:

Contents of stuff.html: STUFF .

whereas with Chrome the result is missing the contents of stuff.html:

Contents of stuff.html: .

The current version used with this test is:

Google Chome 10.0.648.82 beta


This occurs when you use jquery-include in the local file system file: with versions of Chrome released in the last year.

It's due to a change in Access-Control restrictions in the local filesystem which was made to address valid security risks. You can overide this behaviour by starting Crome from the command line with the --allow-file-access-from-files flag. Judging by the lengthy discussion on Chromium issues here and here this is unlikely to be resolved.

Using jquery-include with Chrome over http is not affected.

See also here on SO.

0

精彩评论

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