JSFiddle - React, Tailwind, and code Playground

by eurica

HTML

<div id="dashboard"></div>

CSS

iframe, body, #dashboard {
    height: 100%;
    padding: 0; margin: 0; border: 0;
    overflow: hidden;
}

JavaScript

urls = [
    "https://webdemo.pagerduty.com/incidents"
]
width = (100/urls.length)+"%";
//width = Math.floor($("#dashboard").width()/urls.length);
//alert(width)
for (i in urls) {
    $('<iframe>Loading...</iframe>').attr('src', urls[i]).width(width).appendTo('#dashboard');    
}


update = function() {
    iframes = $('iframe');
    dummydata = "dummydata="+(new Date()).valueOf()
    for (i in urls) {
        newurl = urls[i];
        if(newurl.indexOf("?")==-1) { 
            newurl=newurl+"?"+dummydata
        } else {
            newurl=newurl+"&"+dummydata
        }        
        $(iframes[i]).attr('src', newurl);
        console.log(newurl)
    }

}
window.setInterval(update,10000);