Forum Moderators: open

Message Too Old, No Replies

Blinking Refresh

I need to refresh an iframe frequently without blinking

         

OceanBear

2:48 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



Hello!

I have an application that requires an area of the screen to be refreshed with new data from the server every second.

I have currently implemented it using an iframe with the content of the iframe containing:

<Meta http-equiv="refresh" Content="2">

It also contains

onload="window.scrollTo(0,5000)"

as I need it to always display the end of the "data".

The iframe reference looks like:

<Iframe name="iframe" src="http://urlgetrequest" etc.>

It all works perfectly - the get request is processed and supplies the "updated" data.

There are two things wrong with this approach that I need to find solution to.

1) The refresh "blinks" (i.e. erases then redisplays) and it is annoying to users,
2) The bottom of the web browser blinks the get request and progress bar in a distracting manner as the new page is refreshed.

How can I fix this - and is there a better way to get "real-time" data from my server displayed in an area of the screen?

Please reply here or feel free to write to me at christopherdavidbear@yahoo.com.

- Christopher

CloudLong

2:57 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



Its impossible.

don't want to blink, then don't refresh it.

2 seconds refresh are way too fast, I suggest 10 seconds refresh or above, because if the user urge to refresh the page, they can do it by themselves.

or you may add button which allow user manually refresh the page

<input type=button onclick="history.go();" name=refresh value=Refresh>

OR as link

<a href="javascript:void(0);" onclick="history.go();">Refresh</a>

[edited by: CloudLong at 3:07 pm (utc) on Dec. 29, 2003]

OceanBear

3:06 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



But how do developers implement things like ticker-tapes (the next project I need to do).

Then there must be a way to "scroll" data received instead of a refresh?

CloudLong

3:13 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



what is ticker tapes? can u specify it? or give an example for it?

storevalley

3:19 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



But how do developers implement things like ticker-tapes

Using layers, generally. Search Google for Mike's DHTML scroller ... this is an example.

CloudLong

3:25 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



THe ticker tape that you showed to me is have all of the data already inside when its loaded, it just manipulate the way its appear to the browser.

to get a new data to a browser, there is only one way, that is to refresh the page.

OceanBear

3:43 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



But what about "chat rooms" that is an example of real-time data arriving from the server and it appears to scroll as people add their words (and there is no refresh or progress bar going on).

How is that done?

korkus2000

3:47 pm on Dec 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A lot of what you are talking about is done in Java and not Javascript. Chat rooms and scrollers are usually applets. They have more access to the paint commands of the browser through the jvm. Javascript just does not have that power.

CloudLong

4:55 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



Yes, Javascript won't able to do such things, you may able to do it with PERL or PHP. I've seen a HTML base chat room that is build using PERL language.

OceanBear

5:07 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



I write all server-side code in C.
I have ported dozens of PHP applications to C because I prefer the (complete) server-side control that it gives me.

I can really do "anything" on the server side - what I need is to put something on the client side but not an applet.

It needs to blend in perfectly with the existing site and not to require any downloads or installs etc.

Ideally "something" would exist on the client side that can generate some form of get/post http request to get the data and then display it in a manner that I can "blend" with the website so that it all appears consistent (i.e. we cannot use a separate window).

I would be willing to contract the solution out to someone if they are interested in helping. I often have similar technology problems and it would be good to know someone who is a bit of a guru in such things (christopherdavidbear@yahoo.com).

storevalley

5:57 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



The only thing I can think of here is Flash MX 2004. As far as I know, it does have built in data access controls, and enough browsers have the Flash plug-in that it almost negates the component download issue.

Type "flash time entry application" into Google ... this'll help you to locate an article on Macromedia's site giving you some samples.

If this doesn't help, perhaps you can tap up the Macromedia Development community for further ideas.

CloudLong

10:46 pm on Dec 29, 2003 (gmt 0)

10+ Year Member



*grin* why don't you run that script on your own computer, then it will not blinking. *sarcasm*

DrDoc

1:57 am on Dec 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The chat room thing is different... It is all handled in one request, except that the server never sends an "end of file" status to the browser, causing the browser to sit and wait. Then, as new messages are received, they can be sent directly to the browser (provided that buffering is turned off in the script). You can do this in any server side scripting language.

OceanBear

9:08 am on Dec 30, 2003 (gmt 0)

10+ Year Member



The continuous stream without an EOF sounds potentially useful - but - in my experience whenever the browser does not get "something" for "a while" (like when I have a bug in my server-side code) the browser times out and says "page not found" or something.

Then of course there is the issue of a large number of threads on the server remaining open - I suppose that I can time them out but this will be difficult to manage in this case.

The chat room idea is an interesting analogy because this is "exactly" the behaviour that I ultimately need.

Someone else recently mentioned that one answer lies in this document:

[developer.apple.com...]

I have attempted to read it but it is a just a bit out of my league - especially since I really just want client-side cgi requests to display their results "gracefully" - I can handle the server side. This article is confusing in its references to the server code.

If any of you have a moment or two to look at it and let me know if it is steering me in the right direction (or even to translate it into a few steps or an example that would be really appreciated.

- Christopher

CloudLong

9:21 am on Dec 30, 2003 (gmt 0)

10+ Year Member



go to [gtchat.de...] for PERL chat

TrinkDawg

4:05 pm on Jan 2, 2004 (gmt 0)

10+ Year Member



Hi Christopher, not sure if this will help you or not, but here is a good way to get new content and display it on the screen somewhere without the annoying erasing and refreshing:

[ashleyit.com...]

Or just do a Google search for jsrs. Of course, if the user has JavaScript disabled you are hosed. Good luck.