Click to See Complete Forum and Search --> : Need help including an outside file


Cubsy
01-06-2004, 01:47 AM
So basically I need to be able to have a single cell in my html page constantly be updated. I could use an inline frame but that makes me feel kind of dirty.

I think the only way is to have an outside file that is constantly changing and set a timer to pull its contents every 500 ms or so. This is where I run into my problem.

I know how to use the <script src=blah.js></script> but so far as I know that can only be pulled once. If blah.js changes the page wont get the changes until a refresh. Is there someway to pull in an outside file mid function?

FYI. Any clean solution will work, I am experienced in php and do not fear cgi/bin scripts. The info is in a mysql database and I have had little experience with javascript.

Thanks in advance

Cubsy
01-06-2004, 02:04 AM
Okay, so I was lazy and didnt use the search. It appears that once you send the stuff to the client you cant pull anything more off of your server, so I have to do a refresh.

The new question is... Is an inline Frame the only way to do this?

Pittimann
01-06-2004, 02:27 AM
Hi!

You said you know how to deal with external .js files. If that means that you know, how to get your contents for the cell out of a .js - here is a solution:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<script language="JavaScript" type="text/javascript" src="blah.js" id="updateMe"></script>
<script language="JavaScript" type="text/javascript">
<!--
var updJS;
function upd(){
updateMe.src="blah.js";
window.setTimeout('upd()', 500);
}
//-->
</script>
</head>
<body onload="upd()">
</body>
</html>

As a matter of fact, the problem with this might be that the user's browser tries to get the file contents from the cache instead of downloading the file again...

Cheers - Pit

ray326
01-06-2004, 09:52 AM
This article (http://devedge.netscape.com/viewsource/2003/inner-browsing/) on Inner Browsing covers what you want to do and includes some examples. Of course the caching problem may raise it's ugly head but you can try to circumvent that with cache control meta tags in the background-loaded page(s).

Note: This uses an iframe but only as a temporary storage mechanism.

Cubsy
01-08-2004, 05:51 PM
Thanks that helps a lot. Just what I was looking for.