From: klaus1 on
Hi,

I tried many times to redirect after a page is disabled, and the user
presses F5 or anything else.
Therefore I found the onbegforeunload event, which might be usefull.
I don't like any kind of message box, just if the user gets the page,
each keypress should redirect on another page.
Only the first request should be placed on the site.
My code:

<html>
<head>
<script type="text/javascript">

window.onbeforeunload= function(){
window.location.href('http://www.google.com');
}

</script>
</head>
<body>

timeout exceeded!
</body>

</html>

It does not work..
any suggestions for me without having a message box?
thanks,
Klaus
From: Thomas 'PointedEars' Lahn on
klaus1 wrote:

> I tried many times to redirect after a page is disabled, and the user
> presses F5 or anything else.
> Therefore I found the onbegforeunload event, which might be usefull.

A lot of other script-kiddies thought so, which is why browser vendors
eventually decided that the only thing a listener for that *proprietary*
event should be able to do is to ask the user if they really want to leave.
Thus you may return only a string value to indicate part of the text that
is used for that prompt.

> I don't like any kind of message box, just if the user gets the page,
> each keypress should redirect on another page.

Use server-side redirects.

> Only the first request should be placed on the site.
> My code:

Dump it.

> [...]
> window.onbeforeunload= function(){
> window.location.href('http://www.google.com');
> }

Users will not take kindly on your redirecting them just anywhere (even if
it is Google) just because you are incompetent enough to break your site on
restructuring (or whatever). Redirect to a superordered entity, e.g. the
home page, of your site if your must, better yet redirect to the new
location of the resource or respond with status code 410 (Gone).

<http://www.w3.org/QA/Tips/uri-choose> pp.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
From: klaus1 on
On 16 Mrz., 12:30, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
> klaus1 wrote:
> > I tried many times to redirect after a page is disabled, and the user
> > presses F5 or anything else.
> > Therefore I found the onbegforeunload event, which might be usefull.
>
> A lot of other script-kiddies thought so, which is why browser vendors
> eventually decided that the only thing a listener for that *proprietary*
> event should be able to do is to ask the user if they really want to leave.  
> Thus you may return only a string value to indicate part of the text that
> is used for that prompt.
>
> > I don't like any kind of message box, just if the user gets the page,
> > each keypress should redirect on another page.
>
> Use server-side redirects.
>
> > Only the first request should be placed on the site.
> > My code:
>
> Dump it.
>
> > [...]
> > window.onbeforeunload= function(){
> > window.location.href('http://www.google.com');
> > }
>
> Users will not take kindly on your redirecting them just anywhere (even if
> it is Google) just because you are incompetent enough to break your site on
> restructuring (or whatever).  Redirect to a superordered entity, e.g. the
> home page, of your site if your must, better yet redirect to the new
> location of the resource or respond with status code 410 (Gone).
>
> <http://www.w3.org/QA/Tips/uri-choose> pp.
>
> PointedEars
> --
> Use any version of Microsoft Frontpage to create your site.
> (This won't prevent people from viewing your source, but no one
> will want to steal it.)
>   -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)

OK, can you tell me the way with the message box, so that I can
redirect after asking the user?
Thanks,
Klaus
From: Thomas 'PointedEars' Lahn on
klaus1 wrote:

> Thomas 'PointedEars' Lahn wrote:
>> klaus1 wrote:
>> > I tried many times to redirect after a page is disabled, and the user
>> > presses F5 or anything else.
>> > Therefore I found the onbegforeunload event, which might be usefull.
>>
>> A lot of other script-kiddies thought so, which is why browser vendors
>> eventually decided that the only thing a listener for that *proprietary*
>> event should be able to do is to ask the user if they really want to
>> leave. Thus you may return only a string value to indicate part of the
>> text that is used for that prompt.
>>
>> [...]
>
> OK, can you tell me the way with the message box, so that I can
> redirect after asking the user?

<http://lmgtfy.com/?q=onbeforeunload>

Please trim your quotes to the relevant minimum.


PointedErs
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk>
From: klaus1 on
i need anything to redirect if the question is answered by pressing
the OK button.
how can I use an if / else for the choosen button?
window.location does not work...
thanks,