[Solved] IFRAME content is not updating in jQuery

Last Reply 3 months ago By aravindg86

Posted 3 months ago

I am binding SSRS report to Iframe. First time Iframe content was loading properly but next time on words even data has changed it still showing old content. Content was not updating for 2nd time onwords.

JQuery Iframe content is not updating

var newSrc1 = '@GlobalVariables.SSRSReportsServerUrl' + '&rs:Command=Render&rs:Format=HTML4.0&rc:Toolbar=falseReport);
$('#Viewerform1').attr('src', newSrc1);
$('#ReportViewer1').show();

<div id="ReportViewer1" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-labelledby="myModalLabel" aria-hidden="true" style="@String.Format("width:1280px; height:1024px; margin-left:22%")">
    <div class="modal-dialog modal-dialog-centered" role="document" style="@String.Format("width:1280px; height:1024px;")">
        <div class="modal-content alert-info" style="@String.Format("width:1280px; height:1024px;")">
            <br />
            <button type="button" id="btnBackOrder" class="btn btn-primary" title="Click to go back for new order details" style="margin-left: 2%">Back OrderDetails</button>
            <div>
                <iframe id="Viewerform1" frameborder="0" style="@String.Format("width:1280px; height:1024px;")" scrolling="yes"></iframe>
            </div>
        </div>
    </div>
</div>
Posted 3 months ago

Some how I fixed this issue by adding below lines of code in layout which clears the cache.

<meta http-Equiv="Cache-Control" Content="no-cache, no-store, must-revalidate">
<meta http-Equiv="Pragma" Content="no-cache">
<meta http-Equiv="Expires" Content="0">