473,320 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Trying To Poll Server Via Hidden IFrame

Hi.

I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:

window.parent.handleServerResponse();

The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?

I thank you for your help.
Peter

Mar 14 '07 #1
5 2648
pbd22 said the following on 3/14/2007 12:48 PM:
Hi.

I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:
What "online errata"?
window.parent.handleServerResponse();

The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?
You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 14 '07 #2
On Mar 14, 10:12 am, Randy Webb <HikksNotAtH...@aol.comwrote:
pbd22 said the following on 3/14/2007 12:48 PM:
Hi.
I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:

What "online errata"?
window.parent.handleServerResponse();
The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?

You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Hi Randy,

Thanks for your reply.
Well, that particular function comes from the below link:

http://www.bazon.net/mishoo/rpc.epl

But, the "online errata" that I have been following most closely has
been the bit about RPCs by the engineers at Apple:

http://developer.apple.com/internet/...nt/iframe.html

In both cases, I have found that when my long-running process
(in this case a video upload via hidden iframe) has completed,
the client-side function gets called.

I want to poll the long-running process **as it is happening**. The
polling routine will query information provided by the server page
(bytes uploaded, percent, total bytes, time, etc) and return that
information to the client in intervals of a few seconds for an in-
process client-side progress display.

I am glad to hear this isn't too complicated. I am wondering if you
wouldn't mind providing the steps, code, links, or whatever you think
could help me get my mind wrapped around what I am trying to do. I'd
apprecaite that.

Thanks again.
Peter

Mar 14 '07 #3
On 14 Mar, 17:38, "pbd22" <dush...@gmail.comwrote:
On Mar 14, 10:12 am, Randy Webb <HikksNotAtH...@aol.comwrote:
pbd22 said the following on 3/14/2007 12:48 PM:
Hi.
I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:
What "online errata"?
window.parent.handleServerResponse();
The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?
You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Hi Randy,

Thanks for your reply.
Well, that particular function comes from the below link:

http://www.bazon.net/mishoo/rpc.epl

But, the "online errata" that I have been following most closely has
been the bit about RPCs by the engineers at Apple:

http://developer.apple.com/internet/...nt/iframe.html

In both cases, I have found that when my long-running process
(in this case a video upload via hidden iframe) has completed,
the client-side function gets called.

I want to poll the long-running process **as it is happening**. The
polling routine will query information provided by the server page
(bytes uploaded, percent, total bytes, time, etc) and return that
information to the client in intervals of a few seconds for an in-
process client-side progress display.

I am glad to hear this isn't too complicated. I am wondering if you
wouldn't mind providing the steps, code, links, or whatever you think
could help me get my mind wrapped around what I am trying to do. I'd
apprecaite that.

Thanks again.
Peter
why not have a second iframe, hidden like the first (OR use XHR), but
this one is used to receive data.
you /can/use the other one provided it is able to keep flushing small
bits of javascript back. In the past I have found the simpler way was
to keep querying a 2nd iframe (or scriptin using XHR) whose source is
"are_we_there_yet_papa_smurf.php?filename=uploaded filename"
or where a session is set and the filename is not needed to be sent.

that way the are_we_there_yet_pap_smurf.php script can stat the
uploading file, perform the calculations and send back the data inside
script tags, (or when using XHR, pre JSON data for security)
a receiving script in the parent then uses this javascript data to
update the DOM with the details.
you call are_we_there_yet_pap_smurf.php using an interval (or
setTimout) based on a variable sent back, doagain = 1, on upload
succeeded the variable is changed to doagain = 0; and the thing
updates once with the final data, and stops.

Does that all make sense?

Mar 14 '07 #4
pbd22 said the following on 3/14/2007 1:38 PM:
On Mar 14, 10:12 am, Randy Webb <HikksNotAtH...@aol.comwrote:
>pbd22 said the following on 3/14/2007 12:48 PM:
>>Hi.
I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:
What "online errata"?
>>window.parent.handleServerResponse();
The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?
You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/

Hi Randy,

Thanks for your reply.
Well, that particular function comes from the below link:

http://www.bazon.net/mishoo/rpc.epl

But, the "online errata" that I have been following most closely has
been the bit about RPCs by the engineers at Apple:

http://developer.apple.com/internet/...nt/iframe.html

In both cases, I have found that when my long-running process
(in this case a video upload via hidden iframe) has completed,
the client-side function gets called.

I want to poll the long-running process **as it is happening**. The
polling routine will query information provided by the server page
(bytes uploaded, percent, total bytes, time, etc) and return that
information to the client in intervals of a few seconds for an in-
process client-side progress display.

I am glad to hear this isn't too complicated. I am wondering if you
wouldn't mind providing the steps, code, links, or whatever you think
could help me get my mind wrapped around what I am trying to do. I'd
apprecaite that.
The IFrame that is hosting the call to the "long running process" can
also poll the server to see if the long running process is finished or
not. One possible way of doing that is to modify the long running
process to write a file - on the server - that estimates how far along
it is. Your second poll checks that file and sees where it is at. Then
it can update the main page.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 15 '07 #5
On Mar 14, 5:56 pm, Randy Webb <HikksNotAtH...@aol.comwrote:
pbd22 said the following on 3/14/2007 1:38 PM:
On Mar 14, 10:12 am, Randy Webb <HikksNotAtH...@aol.comwrote:
pbd22 said the following on 3/14/2007 12:48 PM:
>Hi.
I am trying to poll a long-running process via a hidden IFrame.
I am noticing that the online errata gives advice for handling a
server response:
What "online errata"?
>window.parent.handleServerResponse();
The problem I am having with this is that the above function
gets called ***after*** the long-running response is completed.
How do I poll the long-running process ****as**** it is being
executed? Say, every 5 seconds or so?
You have the long-running process update a file on the server. Then you
check the file for the status. It could be as trivial as setting a
variable to false and when it finishes changes that variable to true.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Hi Randy,
Thanks for your reply.
Well, that particular function comes from the below link:
http://www.bazon.net/mishoo/rpc.epl
But, the "online errata" that I have been following most closely has
been the bit about RPCs by the engineers at Apple:
http://developer.apple.com/internet/...nt/iframe.html
In both cases, I have found that when my long-running process
(in this case a video upload via hidden iframe) has completed,
the client-side function gets called.
I want to poll the long-running process **as it is happening**. The
polling routine will query information provided by the server page
(bytes uploaded, percent, total bytes, time, etc) and return that
information to the client in intervals of a few seconds for an in-
process client-side progress display.
I am glad to hear this isn't too complicated. I am wondering if you
wouldn't mind providing the steps, code, links, or whatever you think
could help me get my mind wrapped around what I am trying to do. I'd
apprecaite that.

The IFrame that is hosting the call to the "long running process" can
also poll the server to see if the long running process is finished or
not. One possible way of doing that is to modify the long running
process to write a file - on the server - that estimates how far along
it is. Your second poll checks that file and sees where it is at. Then
it can update the main page.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
Thanks Both.
This has been an extremely helpful thread.
Randy, I like your idea of using the same iframe for polling as
upload, but only have one question about writing to a second file for
data updates. I have designed a custom event handler that gets called
every time bytes get uploaded to the FTP server. This event handler
would be updating the second page with new upload information. To me,
this means that there would be a ton of read/writes happening on the
server as the data page gets updated. Wouldn't this method be sort of
costly to the server?

Mar 15 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Matt | last post by:
I want to open a page that is hidden to the user. Some people suggest me to use hidden iframe. Is it a good solution? Any good examples?
4
by: L Anthony Johnson | last post by:
Has anyone had any success doing this. I have tried, but the InnerHTML property always comes back as an empty string. L Anthony Johnson
4
by: Drew | last post by:
This might beyond the scope of this group because it deals with SharePoint, but I'm not sure if I can't get it to work because of SharePoint or because JavaScript is weird (I don't have much...
1
by: SMichal | last post by:
Hi, is there some posibility how to read inner text from IFRAME on server-side ? I've tested it with innerText and InnerHtml but it doesnt work
5
by: pbd22 | last post by:
hi. i have a hidden iframe for uploading files. when i check the httpfilecollection on the server, it is always zero - the files never make it to the server. i know all the javascript is working...
2
by: mandarchalke29 | last post by:
Dear sir, Can anyone please tell me how to add an hidden field on IFRAME. The IFRAME is not added in Form. its just a frame can i add like this? <iframe id="thread" name="thread"...
3
by: John Dalberg | last post by:
I am looking for an asp.net based chat software. I have looked at some (asp.net and php based) and they consist usually of a javascript piece where the web user (visitor) initiates a chat from a...
6
by: buntyindia | last post by:
Hi, I have a page. There is a section 'sidebar' where bulleted text is there. Just after first bullet there is a hidden IFRAME. That go visible on clicking of that bullet text. My problem is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.