Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Index.html脚本标记值在运行时被替换_Javascript_Jquery_Html_Amazon S3_Cors - Fatal编程技术网

Javascript Index.html脚本标记值在运行时被替换

Javascript Index.html脚本标记值在运行时被替换,javascript,jquery,html,amazon-s3,cors,Javascript,Jquery,Html,Amazon S3,Cors,我对CORS和网页有问题: 网页值在页面加载之前更改 但是在其他页面上不会发生这种情况 我无法使用jQuery正确加载主页 但是使用相同脚本的所有其他页面都可以正常加载 在Chrome上不起作用 但它可以在本地和Firefox上工作 更改了S3 CORS配置权限,但尚未修复该问题 AWS S3存储桶>权限>CORS配置 为什么在Chrome读取之前源代码会发生变化 在另一页中编写脚本,并将其链接到底部的head或body标记中。 如下所示: 功能。。。 或: 功能。。。

我对CORS和网页有问题:

  • 网页值在页面加载之前更改
    • 但是在其他页面上不会发生这种情况
  • 我无法使用jQuery正确加载主页
    • 但是使用相同脚本的所有其他页面都可以正常加载
  • 在Chrome上不起作用
    • 但它可以在本地和Firefox上工作
  • 更改了S3 CORS配置权限,但尚未修复该问题
    • AWS S3存储桶>权限>CORS配置

为什么在Chrome读取之前源代码会发生变化

在另一页中编写脚本,并将其链接到底部的head或body标记中。 如下所示:


功能。。。
或:


功能。。。
在head标记中编写脚本语言,然后在bottombody标记中尝试或。 如下所示:

<script type="text/javascript">function...
</script>`
</body>
函数。。。
`

`

Than’s not Than请删除您的浏览器历史记录,并关闭所有选项卡,然后在浏览器选项卡中右键单击URL并运行。

也许您应该先自己做更多的工作。
<!DOCTYPE html>
<html lang="en">
    <head>
        <script
            type="text/javascript" crossorigin="anonymous">$(function () { $.get("https://s3-example.amazonaws.com/aws-codestar-example/public/assets/head.html", function (data) { $("head").prepend(data); }); });</script>
    </head> 
    <body class="container">
    </body>
</html>
Access to XMLHttpRequest at 'https://s3-example.amazonaws.com/aws-codestar-example/public/assets/head.html' from origin 'http://example2.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
<script src="Right the link page" type="text/javascript">
function...
</script>
</body>
<script type="text/javascript" src="Right the link page">
  function...
</script>
</head>
<script type="text/javascript">function...
</script>`
</body>
<script type="text/javascript"></script>`
</head>