Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / XHTML

Objects in Internet Explorer

1.64/5 (5 votes)
3 Jun 2006 1  
Simple code to eliminate the frame generated by Internet Explorer in the objects

Introduction

This code is a simply demostration how eliminate the "frame" (allowing interactivity) with the "OBJECT"s, without having to modify all the objects included in the code.

How do it

Well, you only have to add a *.js file (it doesn't work if you try to put the code in HTML code directly) in the bottom position of your HTML code, with this code:

function gestionFlashObj() {
 var navegador_ = navigator.appName;
 if (navegador_ == "Microsoft Internet Explorer") {
  var obj; 
  var i=document.getElementsByTagName("OBJECT").length -1; 
  var aux=""; 
  if (i<0) return;
  while (aux!= null) 
  { 
    aux=document.getElementsByTagName("OBJECT")[i].outerHTML; 
    document.getElementsByTagName("OBJECT")[i].outerHTML="<div id='objectoOb"+i+"'></div>"; 
    escribirPAntalla(document.getElementById("objectoOb"+i),aux); 
    i--; 
   }; 
  if (i<0) return;
  aux=document.getElementsByTagName("OBJECT")[i]; 
  }   
 }
}
function escribirPAntalla(aux,cont) { 
 if (aux!=null || cont!=null){
  aux.innerHTML=cont; 
 }
}
gestionFlashObj();

...you can see that  I only change the objects with another one, writing from the js.

VIP:You only have to be careful with "base" tags in the HTML code because when the js is executed the "base" aren't in use.


 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here