stop iframe loading



  • Hi guys, any one of you knows how to stop iframe loading ?
    We are able to stop loading jpgs, pngs by using request mask deny, but how about iframe?



  • Using execute javascript action you can set src of iframe to "" so it will load nothing

    document.getElementById('myIframe').src = ""
    

    , or remove all the iframes using javascript

    var iframes = document.querySelectorAll('iframe');
    for (var i = 0; i < iframes.length; i++) {
        iframes[i].parentNode.removeChild(iframes[i]);
    }
    


  • @niceusername thanks for reply but as I know i cant apply this code while website is loading? right?!
    ss.png
    before or after LOAD event?



  • @ozsuakin Right, but you should know that I don't know how your script is working but i did tell you how to stop iframe loading. Regarding solution there can be two options.

    1. for that you can use wait while element exist action http://prntscr.com/s78u7g
    2. OR if you want to wait for more than one minute then this code can be helpful
    function waitForElement(id, callback){
        var poops = setInterval(function(){
            if(document.getElementById(id)){
                clearInterval(poops);
                callback();
            }
        }, 100);
    }
    
    waitForElement("idOfElementToWaitFor", function(){
        alert("element is loaded.. do stuff");
    });
    

    source : https://stackoverflow.com/a/34863951/8858217
    after that you can use Wait full page load, i don't think you should use it before so iframe element will be detected early.


Log in to reply