iframe alternatives

Asked

Viewed 1,947 times

0

I would like to know 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> 
  • 1

    What you need to do?

  • find a way to show an iframe on all browsers including IE8. , I just want to show that page that I also created

2 answers

1

Option 1

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

Works, but according to W3C is for interactive content or media

Option 2 Through Xmlhttprequest and post the content in 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();
}

1

  • 1

    It would be interesting to show how the function works to make your answer more complete

Browser other questions tagged

You are not signed in. Login or sign up in order to post.