【问题标题】:iframe without refresh browser when I change src当我更改 src 时没有刷新浏览器的 iframe
【发布时间】:2013-11-06 09:04:28
【问题描述】:

如何防止更改 iframe src 时浏览器不刷新?

脚本加载 iframe:

function load(page, iframe){
var image_load = "<div class='ajax_loading'><img src='"+loading_image_large+"' /></div>";
$.ajax({
    url: site+page,
    dataType: 'json',
    type :'POST', 
    dataType:"html",
    beforeSend: function(){
        $(div).html(image_load);
    },
    success: function(response){
        $(iframe).attr('src', "http://192.168.1.13:8080/server/flow.html?_flowId=viewReportFlow&standAlone=true&reportUnit="+ Product.uri +"&j_username=joeuser&j_password=joeuser");
    }       
});
}

html:

$('#iframex').get(0).contentWindow.location.reload(true);
 //html
<iframe id="iframex" frameborder="0"></iframe>

【问题讨论】:

    标签: javascript html jquery iframe


    【解决方案1】:

    这一行是 make reload 因为 reload=true

    删除线然后工作正常

    $('#iframex').get(0).contentWindow.location.reload(true);
    

    【讨论】:

    • 我删除了它但它没有用..在我更改 iframe src 后继续重新加载浏览器..对不起我的英语太糟糕了
    【解决方案2】:

    据我所知,iframe 需要刷新浏览器页面才能解析源代码。因此,当您在 ajax 返回数据时更改 src 时,它正在刷新页面

    【讨论】:

      猜你喜欢
      • 2015-02-18
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 2012-12-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多