Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto refresh iFrame

Status
Not open for further replies.

Enkrypted

Technical User
Sep 18, 2002
663
US
Currently I have the following script on a page that will refresh an iFrame:

Code:
<script>
window.setInterval("reloadIFrame();", 5000);

function reloadIFrame() {
 document.frames["marquee"].location.reload();
}
</script>

It works great in IE, but unfortunately it doesn't appear to work in Chrome or Firefox. How can I get Chrome and Firefox to auto refresh the iFrame after a set amount of time?

Enkrypted
A+
 
have you tried using an ID on the element?

Code:
function reloadIFrame() {
 document.getElelementById('myID').location.reload(true);
}

is the iFrame src on the same domain?

It is possible to refresh cross domain iFrames if you change the src attribute.

Code:
document.getElementById('iframeid').src = document.getElementById('iframeid').src;

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Electronic Dance Music Download
 
have you tried using an ID on the element?

Code:
function reloadIFrame() {
 document.getElelementById('myID').location.reload(true);
}

is the iFrame src on the same domain?

It is possible to refresh cross domain iFrames if you change the src attribute.

Code:
document.getElementById('iframeid').src = document.getElementById('iframeid').src;

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"

Free Electronic Dance Music Download
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top