Answered by:
Iframe problem for opera

Question
-
User464223691 posted
hello everybody ....
I am using iframe for my site and i have javascript to increse the height of iframe according to size of the content in iframe ,but problem is working on all other browser except opera
Here is the javascript ::
<script type="text/javascript">
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["FRAMEID"]
var iframehide="yes"var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsersfunction resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller</script>
need solution in this ..thank u
Sunday, August 12, 2012 11:18 PM
Answers
-
User-489377026 posted
Hi sATsvelKe,
I have go through your code, it is not following the standard format. Please edit it.
if (currentfr && !window.opera){Please excludes "opera" from the logic that computes the frame height using browser-specific properties.
And here are some similar problem link, please refer:
http://www.dynamicdrive.com/forums/showthread.php?t=26934
Thanks
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 15, 2012 11:41 PM -
User464223691 posted
Thanks for replying guys , the script do not support on opera , just need to give height to iframe manually with scroll on , and the script will work dynamically on all other browsers .
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, August 18, 2012 6:43 PM
All replies
-
User-489377026 posted
Hi sATsvelKe,
I have go through your code, it is not following the standard format. Please edit it.
if (currentfr && !window.opera){Please excludes "opera" from the logic that computes the frame height using browser-specific properties.
And here are some similar problem link, please refer:
http://www.dynamicdrive.com/forums/showthread.php?t=26934
Thanks
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, August 15, 2012 11:41 PM -
User464223691 posted
Thanks for replying guys , the script do not support on opera , just need to give height to iframe manually with scroll on , and the script will work dynamically on all other browsers .
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Saturday, August 18, 2012 6:43 PM