0

I'm working on a browser with a full Iframe with randomly alternating websites within. I found a piece of 'JavaScript' which works in Safari, however in certain browsers (Firefox, Chrome) the frames height becomes narrow rather than the full length of the screen. I've tried removing of the other html just incase something was interfering with the script but still have the same results. Here's the javascript I'm working with –

var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1

//Specify IFRAME display attributes
var iframeprops='width="100%" height="100%" border="none" position="fixed" top="0px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" z-index"-20"'

//Specify random URLs to display inside iframe
var randomcontent=new Array()
randomcontent[0]="http://.."
randomcontent[1]="http://..."
randomcontent[2]="http://...."

//No need to edit after here
if (ie||dom)
document.write('<iframe id="dynstuff" src="" '+iframeprops+'></iframe>')

function random_iframe(){
if (ie||dom){
var iframeobj=document.getElementById? document.getElementById("dynstuff") : document.all.dynstuff
 iframeobj.src=randomcontent[Math.floor(Math.random()*randomcontent.length)]
}
}

window.onload=random_iframe

I've also attached attached a screenshot. Green arrow is the restricted length of the iframe. Yellow is what I'm after – the full length of the browser

enter image description here

aaron_m12345
  • 113
  • 3
  • 12

1 Answers1

-1

Do it with CSS:

//Specify IFRAME display attributes
var iframeprops='width="100%" height="100%" border="none" position="fixed" top="0px" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" z-index"-20"'
iframeprops += ' style="height:100%;" '; //<--- This is the new attribute
Jorgeblom
  • 3,330
  • 1
  • 23
  • 24