Iframe alternatives [duplicate]

0

I would like to know what are the alternatives to replace an iframe.

I have this code:

<iframe src="noticia.html" width="550" height="400" 
scrolling="auto" style="position: absolute; left: 2%; top: 38%;"> 

</iframe> 
    
asked by anonymous 13.03.2015 / 18:25

2 answers

1

Option 1

   <embed src="noticia.html" width=100 height=100 />

It works, but according to W3C it's for interactive content or media

Option 2 Through the XMLHttpRequest and post the content into a div.

function loadPage(){
if (window.XMLHttpRequest){
    // IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
}else{
    //IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}

xmlhttp.onreadystatechange=function(){
    if (xmlhttp.readyState==4 && xmlhttp.status==200){
        document.getElementById("ID_do_elemento").innerHTML=xmlhttp.responseText;
    }
}

xmlhttp.open("POST","WEBPAGE YOU WANT TO LOAD",true);
xmlhttp.send();
}
    
13.03.2015 / 18:33
1

You can use the Jquery Load function to include an html file inside your page! link

    
13.03.2015 / 18:34