Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #16494 > unrolled thread

Event-driven?

Started bymorellik <enrico.morelli@gmail.com>
First post2012-10-09 02:09 -0700
Last post2012-10-12 01:00 -0700
Articles 7 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  Event-driven? morellik <enrico.morelli@gmail.com> - 2012-10-09 02:09 -0700
    Re: Event-driven? Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-10-09 11:30 +0200
    Re: Event-driven? morellik <enrico.morelli@gmail.com> - 2012-10-09 03:10 -0700
      Re: Event-driven? Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-10-09 12:52 +0200
    Re: Event-driven? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2012-10-09 14:34 +0200
    Re: Event-driven? Danny <dann90038@gmail.com> - 2012-10-09 12:45 -0700
      Re: Event-driven? morellik <enrico.morelli@gmail.com> - 2012-10-12 01:00 -0700

#16494 — Event-driven?

Frommorellik <enrico.morelli@gmail.com>
Date2012-10-09 02:09 -0700
SubjectEvent-driven?
Message-ID<af955fd7-891f-4bf8-8074-949afbd775ff@googlegroups.com>
Dear all,

I don't know if what I want to do is related to event driven, so I expose my problem.
I'm developing a web portal where people can query for metals in biology. The query results can be downloaded but the zip file creation keep a long time. I would that when an user click on download link, the file creation starts and the user can visit other pages inside the portal. When the creation file is finished a message or the download box appears on the visiting user's page.

Is it possible? If yes, which technique I've to learn or which libraries?

Thanks in advance
Enrico

[toc] | [next] | [standalone]


#16495

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2012-10-09 11:30 +0200
Message-ID<5073ee9d$0$6914$e4fe514c@news2.news.xs4all.nl>
In reply to#16494
On 10/9/2012 11:09 AM, morellik wrote:
> Dear all,
>
> I don't know if what I want to do is related to event driven, so I expose my problem.
> I'm developing a web portal where people can query for metals in biology. The query results can be downloaded but the zip file creation keep a long time. I would that when an user click on download link, the file creation starts and the user can visit other pages inside the portal. When the creation file is finished a message or the download box appears on the visiting user's page.
>
> Is it possible? If yes, which technique I've to learn or which libraries?
>
> Thanks in advance
> Enrico
>

The easiest approach is to open a new window where the request for 
zipcreation is processed and that will offer a download when the actual 
zip arrives.
That way you have a different page where the request is handles 
serverside, and the page that started it all can be replaced so your 
visitors can continue browsing your site.

Problem is that many people use popup blockers.

You might want to add a message that they should allow the popup, or 
offer a downloadlink and add an explanation: "Please open in new 
window/tab".

More sophisticated solutions exist, that will interrupt any page on your 
site when the zip is ready (via polling and XHR), but this is quite 
cumbersome and possibly more error-prone.

Regards,
Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#16497

Frommorellik <enrico.morelli@gmail.com>
Date2012-10-09 03:10 -0700
Message-ID<682ee778-d001-4afc-9bde-e5dd375c7552@googlegroups.com>
In reply to#16494
Thanks,

but there isn't technique that when an user submit or query something works in background and advise the user when it has finished in pages different from the submitted page?

All js libraries that I founded works on the same page, no one permits to catch an action and display results in other pages.

[toc] | [prev] | [next] | [standalone]


#16498

FromErwin Moller <erwinmollerusenet@xs4all.nl>
Date2012-10-09 12:52 +0200
Message-ID<507401d2$0$6869$e4fe514c@news2.news.xs4all.nl>
In reply to#16497
On 10/9/2012 12:10 PM, morellik wrote:
> Thanks,
>
> but there isn't technique that when an user submit or query something works in background and advise the user when it has finished in pages different from the submitted page?
>
> All js libraries that I founded works on the same page, no one permits to catch an action and display results in other pages.
>

[You replied to yourself, not my posting.]

Javascript (in browsers) work on one page because that is how it is 
implemented by webbrowsers.
HTTP protocol isn't designed to have an active state with the server.
And since javascript in a webbrowser lives in that environment, you have 
to re-initialize whatever state you desire with each pageload.

A few hints to relieve this constraint a little are:
1) If you want to create some state with the server, you have to use 
things like sessions.
2) If you want to remember things in the browser (persistence), use 
cookies or DOM storage (and Web storage).
3) If you want to query the server on regular intervals, have a look at 
XHR (Ajax).

Option 3 could help you, but you have to implement it at every page on 
your site.

I advise you to use a new window for waiting/downloading your zipfile.

Regards,
Erwin Moller

-- 
"That which can be asserted without evidence, can be dismissed without 
evidence."
-- Christopher Hitchens

[toc] | [prev] | [next] | [standalone]


#16500

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2012-10-09 14:34 +0200
Message-ID<XnsA0E7944FF784Ceejj99@194.109.133.133>
In reply to#16494
morellik wrote on 09 okt 2012 in comp.lang.javascript:

> I don't know if what I want to do is related to event driven, 

No, it is not. Better start a new thread next time.

> so I
> expose my problem. I'm developing a web portal where people can query
> for metals in biology. The query results can be downloaded but the zip
> file creation keep a long time. I would that when an user click on
> download link, the file creation starts and the user can visit other
> pages inside the portal. When the creation file is finished a message
> or the download box appears on the visiting user's page. 
 
> Is it possible? 

Easier is to send them an [serverside generated] email on [serverside] 
completion with a temporary link to that zip-file. Serverside garbage 
collection of such files seems necessary btw.

Only serverside javascript could be involved to keep this on topic here.

> If yes, which technique I've to learn

The technique advocated in this NG is javascript.

>  or which libraries? 

Your "or" says it all.

One does only "learn to thrust" libraries, as the act as black boxes.
If you know the library inside out you won't need it, because a dedicated 
script is in your reach and is much safer and usually faster as well.

The trust usually is betrayed by lack of quality an consistence, imho.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#16515

FromDanny <dann90038@gmail.com>
Date2012-10-09 12:45 -0700
Message-ID<99976f6e-c575-4ce4-a359-f3ded3ed36b5@googlegroups.com>
In reply to#16494
I'd say as way to separate the processes, as suggested before by Erwin Moller and others, use a new window, they're correct by the way, popup blockers very likely may block a window.open(), there are criteria however on what's an UNREQUESTED window and a REQUESTED window, and popup blockers work within such criteria.  Anyhow, the way to get around that, is use markup new-windows :), target="_blank", in the form, thus the form will end up submitting to a newly opened window, separating the processes from both windows.  Worse case scenario, the form will open in a Tab rather than a window.  Try as -> http://www.webdevout.net/test?016&raw

As you can see I load a 2nd page 2secs after submission, the form submits to _blank and other page can load on afterwards, why the delay? to allow the submission process to take place before removing the page/form.

[toc] | [prev] | [next] | [standalone]


#16574

Frommorellik <enrico.morelli@gmail.com>
Date2012-10-12 01:00 -0700
Message-ID<17398ee5-46de-4526-9659-ecfc91f5157f@googlegroups.com>
In reply to#16515
On Tuesday, October 9, 2012 9:45:14 PM UTC+2, Danny wrote:
> I'd say as way to separate the processes, as suggested before by Erwin Moller and others, use a new window, they're correct by the way, popup blockers very likely may block a window.open(), there are criteria however on what's an UNREQUESTED window and a REQUESTED window, and popup blockers work within such criteria.  Anyhow, the way to get around that, is use markup new-windows :), target="_blank", in the form, thus the form will end up submitting to a newly opened window, separating the processes from both windows.  Worse case scenario, the form will open in a Tab rather than a window.  Try as -> http://www.webdevout.net/test?016&raw
> 
> 
> 
> As you can see I load a 2nd page 2secs after submission, the form submits to _blank and other page can load on afterwards, why the delay? to allow the submission process to take place before removing the page/form.

Thanks for your example. Very nice.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web