Mangal Pandey
Mangal Pandey

Reputation: 109

How to reload an iframe using anything but loading without blinking

I load iframe by using a JavaScript code but it blinks every time it loads. How can I avoid blinking on loading of an iframe?

This is my code

<script type="text/javascript">
  setInterval(function () {
  var iframe1 = document.getElementById("iframe1");

  iframe1.src = "frmChatRequest.aspx";     
  }, 4000);
</script>

Upvotes: 1

Views: 576

Answers (1)

Mincho Minchev
Mincho Minchev

Reputation: 222

Try this one :

<script type="text/javascript">
  var myInterval = setInterval(function () {
  var iframe1 = document.getElementById("iframe1");
    if(iframe1.src == "frmChatRequest.aspx"){
        clearInterval(myInterval)
    }else{ 
        iframe1.src = "frmChatRequest.aspx";
    }  
  }, 1000);
</script>

Upvotes: 2

Related Questions