【问题标题】:jquery load() works in firefox but not in chrome [duplicate]jquery load() 在 Firefox 中有效,但在 chrome 中无效 [重复]
【发布时间】:2017-07-30 06:39:10
【问题描述】:

以下代码在 Firefox 中运行良好,但在 chrome 中运行良好。我对 jquery 不太熟悉,所以请帮助我。

最终目的是动态改变 class="change" 的 div 内容

$(function(){
    $("#content").load("consulting.html");
  });
$(".change").click(function(){
  var page=$(this).attr('href');
  $("#content").load(page);
  return false;

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
     

【问题讨论】:

    标签: javascript jquery html google-chrome


    【解决方案1】:

    您可以尝试使用 --allow-file-access-from-files 标志启动 chrome / chromium。

    https://askubuntu.com/questions/160245/how-do-i-make-the-google-chrome-flag-allow-file-access-from-files-permanent

    【讨论】:

      【解决方案2】:

      有 3 个可能的答案:

      • 使用--allow-file-access-from-files选项

      • 使用--disable-web-security 选项(不是好的选项)

      • 使用 '127.0.0.1' 而不是 'localhost'

      有关如何在 chrome 上使用选项,请参阅website

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-19
        • 2022-01-23
        • 1970-01-01
        • 1970-01-01
        • 2020-04-04
        相关资源
        最近更新 更多