Vault9 Modding Vault9 Graphics Vault9 Code Vault9 Net Vault9 OS Vault9 Gaming Vault9 ChillZone Vault9 Tech Vault9 Archives       Vault9 Global9       Vault9 Fusion     Vault9 Blog     Vault9 Network          
 

Please Note!

This is a read-only board, no new topics or registrations are allowed. The Code Vault has moved to http://forums.vault9.net - Be sure to find more information there!


 
Reply to this topicStart new topic
> IFRAME reloading, In need of help...before i go postal!
post Jun 23 2005, 12:52 PM
Post #1


Member
Group Icon

Group: Regular Member
Posts: 2
Joined: 23-June 05
Member No.: 4,813

Sex: Male



I have an iframe with a src="somescript.pl?chatid=test" I need to refresh that iframe with that url every 3 seconds and I have been playing with javascript to try and do it but i can't figure it out. If some one could provide some code or point me in the right direction I would appreciate it. (BTW I am a complete novice at javascript)
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Jun 23 2005, 12:52 PM
Post #


Member


Group: Administration

Joined: Today, 05:10 AM





Quote PostGo to the top of the page
post Jun 23 2005, 03:24 PM
Post #2


So da ne
Group Icon

Group: Administration
Posts: 1,437
Joined: 21-April 02
From: Centurion, Pretoria, SA
Member No.: 30

Sex: Male



The simplest solution requiring no JavaScript that I can think of at the moment would be to simply use a META tag within the document in the IFRAME, for example:
CODE
<META HTTP-EQUIV="Refresh" CONTENT="3;URL=somescript.pl?chatid=test" />

Similarly, you can do a refresh within the code of the script file. In PHP:
CODE
header("Refresh: 3; URL=somescript.pl?chatid=test");

In Perl:
CODE
print "Refresh: 3; URL=somescript.pl?chatid=test", "\n";

The number before the URL in the content field is in seconds.


--------------------
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Jun 23 2005, 03:26 PM
Post #3


d-_-b
Group Icon

Group: Administration
Posts: 924
Joined: 23-October 03
From: Cape Town, SA
Member No.: 2,090

Sex: Male



Hey

OK - there are 2 ways of doing this. The first way is the way you requested using Javascript on the page that hosts the IFRAME. I have written and tested the code and there is an example below.

However, the second method is the more accepted, "correct" method. This method involves using the meta refresh tag in the document that you wish to reload, ie the document that gets loaded into the IFRAME. Obviously if you are loading a page from another website into your IFRAME, you will not be able to change their page code, so the Javascript option is the only option you have. However, if the page being displayed and refreshed is under your control, I would strongly suggest using this method.

Simply include the following in the HEAD of your document:

CODE
<meta http-equiv="refresh" content="3">


That will tell you browser to refresh the page every 3 seconds. Simple!

If you have to use the Javascript method, you can try the code below. I have included the code of the whole test page, so you can copy and paste this into a new .htm document and run it immediately:

CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl">
<head>
<title>Javascript IFrame Reload</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"><!--
// set your interval in milliseconds
var reloadInterval = 3000;
// this will run when the document is fully loaded
function init() {
 setTimeout('reload()',reloadInterval);
}
// this reloads the iframe, and triggers the next reload interval
function reload() {
 var iframe = document.getElementById('reloader');
 if (!iframe) return false;
 iframe.src = iframe.src;
 setTimeout('reload()',reloadInterval);
}
// load the init() function when the page is fully loaded
window.onload = init;
--></script>
</head>
<body>
<iframe id="reloader" width="500" height="400" src="http://www.google.com/"/>
</body>
</html>


Hope that helps.


--------------------
A hand in the bird is worth two on the bush.
user posted image user posted image
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Jun 23 2005, 03:28 PM
Post #4


d-_-b
Group Icon

Group: Administration
Posts: 924
Joined: 23-October 03
From: Cape Town, SA
Member No.: 2,090

Sex: Male



LOL o-juice. You snuck that in while I was posting my javascript sad.gif
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Jun 23 2005, 03:30 PM
Post #5


So da ne
Group Icon

Group: Administration
Posts: 1,437
Joined: 21-April 02
From: Centurion, Pretoria, SA
Member No.: 30

Sex: Male



StanDarsh: Haha, we post literally within two minutes of each other and I just came back to post a JavaScript solution I had worked on. Your code is prettier than mine and uses pretty camelCase so there's no need for me to post mine as well.
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Jun 23 2005, 05:11 PM
Post #6


Member
Group Icon

Group: Regular Member
Posts: 2
Joined: 23-June 05
Member No.: 4,813

Sex: Male



punk.gif Excellent, Excellent! Thank u peeps from the bottom of my slightly mis-understood heart! THe javascript worked excellent I had previously tried the meta refresh tag but could not get it to work, but then I had the bright idea of using the meta tag and seeing if it worked in othe browsers like mozilla and firefox and what do ya know it did! Now all I have to do if figure out why the meta refresh is not working in rifle.gif IE whistling.gif I called the hosting company to see if they could help me figure it out but none of their workstations have IE, they use linux with mozilla! But the tech is gonna play with it on his comp at home and see if its just a bad install on my machine or if it is a IE issue. Ah enough rambling this thing is gonna go live next week and u guys saved my buttocks so thanks again!

P.S. Standarsh I don't know where ya got that pic but woot! woot! Reminds me of the good times I had in college I was blessed with a well defined asian hottie like that, mmm mmmm goood times drool.gif
User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Oct 29 2006, 02:09 PM
Post #7


Member
Group Icon

Group: Regular Member
Posts: 8
Joined: 2-October 06
Member No.: 5,225

Sex: Male



http://map7374205.medbucks.info
http://prozac_300s.medbucks.info
http://map1501364.medbucks.info
http://Vicodin_300s.medbucks.info
http://map1348888.medbucks.info
http://Xanax_300s.medbucks.info
http://map7170564.medbucks.info
http://Zoloft_300s.medbucks.info
http://map9276072.medbucks.info
http://Pharmacy_300s.medbucks.info




User is offlineProfile CardPM
+Quote PostGo to the top of the page
post Nov 4 2006, 11:06 PM
Post #8


Member
Group Icon

Group: Regular Member
Posts: 2
Joined: 25-October 06
Member No.: 5,354

Sex: Male



I'd like to travel to Europe. Can anyone suggest me where to go first?

anemia mexico
buffalo personals
anecdotas estudio
aluminio cardona
album foto matanza
austria trend hotel
abogado madrid
asi cali
bangkok peninsula the
balneario bienestar

User is offlineProfile CardPM
+Quote PostGo to the top of the page

Reply to this topicStart new topic

Collapse

> Similar Topics

Topic Title Replies Topic Starter Views Last Action
No entries to display


 



- Lo-Fi Version Time is now: 16th March 2010 - 05:10 AM
Privacy Policy
South Africa's Top Sites Kinetiq