can not get alert to call from setTimeout

L

lkrubner

Is there any reason why this code wouldn't prompt someone to save their
work every 5 minutes? It doesn't seem to be working. This code shows up
in the HEAD of an HTML document.



function saveYourWorkReminder() {
alert("It's been 5 minutes. Please save your work. Web browsers are
buggy and crash often. Protect yourself!");
}

setTimeout("saveYourWorkReminder", 300000);
 
M

McKirahan

Is there any reason why this code wouldn't prompt someone to save their
work every 5 minutes? It doesn't seem to be working. This code shows up
in the HEAD of an HTML document.



function saveYourWorkReminder() {
alert("It's been 5 minutes. Please save your work. Web browsers are
buggy and crash often. Protect yourself!");
}

setTimeout("saveYourWorkReminder", 300000);

Perhaps missing parentheses?

setTimeout("saveYourWorkReminder()", 300000);


BTW, what does your inteneded audience do with a Web browser that require
them to save their work? What would they save and how would they retrieve
it later?
 
D

Dr John Stockton

JRS: In article <ktFtd.628430$mD.506587@attbi_s02>, dated Wed, 8 Dec
2004 15:54:56, seen in McKirahan
BTW, what does your inteneded audience do with a Web browser that require
them to save their work? What would they save and how would they retrieve
it later?

When filling in a large text-area, perhaps composing a news article, one
can in Windows copy'n'paste the lot to Notepad and save on disc.

If the server collaborated, one could send it a part-text to be kept and
returned on request, with a different button to send completed work.

Etc.
 
L

lkrubner

Thank you. I'll write it like this:

setTimeout("saveYourWorkReminder()", 300000);

When you say "decent web browser" are you speaking of one that allows
you to save the stuff you are writing in a textarea? I was in a big
online discussion about this problem perhaps 11 months ago and at that
time it seemed that there were no browsers that did a reasonable job as
word processors. Have things changed? What are you referring to?
 
L

lkrubner

Personally, I'm tired of losing my work because some web browser has
crashed. I do a lot of my best writing in the textarea box of some
form. I hate losing work and yet it happens often. Some of the best
weblog posts I've ever written ceased to exist because the web browser
I was using crashed. Some of the best love letters I've ever written
never reached their audience because of the damned browser. For a lot
of people, web browsers have replaced word processors as the place
where they do most of their writing. Yet you can not save your work
when you are in a web browser. It is painful to spend an hour on a
letter and then the browser crashes and you lose all your work.

But the browsers are not the only source of trouble when it comes to
writing online. Most email companies will end your session without
warning and without saving your work. If you spend an hour writing a
love letter in Hotmail and then hit "Send", Hotmail will wipe out your
work and take you back to the login screen.

Me and some friends have been working on a content management system,
and we hope to mitigate these problems. Ultimately, it is a problem
that the browser vendors need to solve, but till that day we are using
common sense and javascript to offer what minor protections we can.
With our software, when your session ends you get taken back to the
login screen, just like in Hotmail, but everything you just posted is
shown on the screen, so you can copy it, log back in, and paste it into
a form. That's a minor protection we offer that I wish Hotmail and
Yahoo and Earthlink offered. Also, we have a "Save" button sitting
above our textarea boxes. The save button doesn't do anything more than
grab the text in the textarea and send it to a new window, but at least
you can then save that new window to your harddrive and get some of the
protection you might expect to get by saving often in a word processor.
 
M

McKirahan

Personally, I'm tired of losing my work because some web browser has
crashed. I do a lot of my best writing in the textarea box of some
form. I hate losing work and yet it happens often. Some of the best
weblog posts I've ever written ceased to exist because the web browser
I was using crashed. Some of the best love letters I've ever written
never reached their audience because of the damned browser. For a lot
of people, web browsers have replaced word processors as the place
where they do most of their writing. Yet you can not save your work
when you are in a web browser. It is painful to spend an hour on a
letter and then the browser crashes and you lose all your work.

But the browsers are not the only source of trouble when it comes to
writing online. Most email companies will end your session without
warning and without saving your work. If you spend an hour writing a
love letter in Hotmail and then hit "Send", Hotmail will wipe out your
work and take you back to the login screen.

Me and some friends have been working on a content management system,
and we hope to mitigate these problems. Ultimately, it is a problem
that the browser vendors need to solve, but till that day we are using
common sense and javascript to offer what minor protections we can.
With our software, when your session ends you get taken back to the
login screen, just like in Hotmail, but everything you just posted is
shown on the screen, so you can copy it, log back in, and paste it into
a form. That's a minor protection we offer that I wish Hotmail and
Yahoo and Earthlink offered. Also, we have a "Save" button sitting
above our textarea boxes. The save button doesn't do anything more than
grab the text in the textarea and send it to a new window, but at least
you can then save that new window to your harddrive and get some of the
protection you might expect to get by saving often in a word processor.

If its such a problem then how about periodically (every minute or so)
having your script highlight the textarea and copy it to the clipboard (and
save it via FSO to a file if you want)?
 
M

McKirahan

[snip]
If its such a problem then how about periodically (every minute or so)
having your script highlight the textarea and copy it to the clipboard (and
save it via FSO to a file if you want)?

Or just manually highlight the text periodically (via Ctrl+A) and save it to
the clipboard (via Ctrl+C or Ctrl+Insert). Then, if your browser crashes,
just open up Notepad and press Ctrl+V (or Shift+Insert) to paste what you
last "saved".

I also look into why your browser crashes so frequently; it's not something
that happens to most of us.
 
R

RobB

McKirahan wrote:

(snip)
I also look into why your browser crashes so frequently; it's not something
that happens to most of us.

My point as well. Although Internet Explorer dies on occasion - with
the familiar '...sorry for the inconvenience' lament - I can't recall
the last time a Mozilla/Gecko UA, Opera, Safari did. When it did, I
suspect it had something to do with Flash, or convoluted scripting, or
plugins.

Presumably your users don't expect any persistence when moving back &
forth between pages, so this 'crashing' occurs within your own page(s).
Why might that be?
 
L

lkrubner

Browser's crash often no matter the operating system or computer or
browser. Safari on OS X crashes and Netscape 7.1 on Linux crashes and
IE on Windows 95 or XP crashes. There is no escaping browser crashes.
For that matter, there is no escaping crashes in, say, Microsoft Word,
but with Word it is easier to save every few minutes.

Or just manually highlight the text periodically (via Ctrl+A) and save
it to
the clipboard (via Ctrl+C or Ctrl+Insert). Then, if your browser
crashes,
just open up Notepad and press Ctrl+V (or Shift+Insert) to paste what
you
last "saved".
No good - often when a browser crashes it crashes the whole computer.
I've lost tons of work this way and so has every single person that I
know. Talk to any college kid, you'll find they are resigned to it -
that most software is bad and crashes often and data is lost is assumed
to be a fact of life.
 
L

lkrubner

When it did, I
suspect it had something to do with Flash, or convoluted scripting, or
plugins.
Um, your point? As far as I know, the web will always have Flash,
convoluted scripting, bad plugins, badly done Java, non-valid HTML,
server timeouts and lost internet connections. Writing code as if
someday all these problems will go away strikes me as unrealistic.

Flash, in particular, seems to crash certain browsers. I can't tell you
how many times I've been writing something, then decided I needed to
look up a fact, so I open a new browser window and go to Google to
research the fact, then click through to one of the sites that Google
brings up, only to have that new site crash the whole browser, because
of some damn stupid advertisement.

Presumably your users don't expect any persistence when moving back &
forth between pages, so this 'crashing' occurs within your own page(s).
Why might that be?
I can try to keep my own pages free of Flash, convoluted scripting, and
plug-ins, but I doubt that my users will only be using my site when
they are working. I don't know many people who do much serious work on
the web while keeping just one window open.
 
L

lkrubner

When filling in a large text-area, perhaps composing a news article,
one
can in Windows copy'n'paste the lot to Notepad and save on disc.

If the server collaborated, one could send it a part-text to be kept
and
returned on request, with a different button to send completed work.
That's what I do personally but what I need to do now is automate
something like that for my end users. What you describe is too complex
so I'm looking for ways to simplify.
 
L

lkrubner

Isn't FSO limited to the Microsoft world? It's an ActiveX object, isn't
it? All our code is open-sourse PHP and Javascript, so ActiveX isn't an
option for us. Even if it was, I'd hate myself if I started telling
users "Just use IE for everything."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top