473,399 Members | 4,192 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,399 software developers and data experts.

History object

I would like to have a "confirm" from my users this way:

For example a user browse a page and click some link, the history
contains now something.

I would like, if the user click "BACK BUTTON" of the browser or on the
keyboard clic "ALT+<left>", to advice he that executing this action he
will loose all the steps he has done till there.

Is it possible?

Any help muc appreciated.

Regards.
--
Fabri
("Sono più di 30 punti...ma è come se fossere 8 o 9....")
Jul 23 '05 #1
6 1383
VK
You have the same onbeforeunload event that was already discussed here:
<http://groups-beta.google.com/group/comp.lang.javascript/browse_frm/thread/9e071a9d1bfb53af/4e2c7c20e3047eb2#4e2c7c20e3047eb2>

Please don't take it as a narration but in both cases you are taking a
very wrong approach. You concidering your users either as some idiots
not knowing what are they doing, or as people with some movement
disabilities. It is not true at all (at least in 99% of cases :-)

If someone wants to close the window, you have to assume that he
*really wants* to close it. If anyone wants to navigate back or out of
the current page, you have to assume that he *really wants* to do it
for some reason which is not really of your business.

In the particular, if someone wants go back, it most probably means
that he filled some fields wrong, or he wants to change the order or
something of this kind. So what use for him of any of your warnings?
Should he still stay and submit wrong data? Or buy something he doesn't
want anymore?

onbeforeunload was introduced not to nag visitors, but to save session
data (say in cookies) and to do all other "leaving work" on the
background.

Jul 23 '05 #2
VK wrote:
You have the same onbeforeunload event that was already discussed here:
<http://groups-beta.google.com/group/comp.lang.javascript/browse_frm/thread/9e071a9d1bfb53af/4e2c7c20e3047eb2#4e2c7c20e3047eb2>

Please don't take it as a narration
[snip]
You are right.

In the particular, if someone wants go back, it most probably means
that he filled some fields wrong, or he wants to change the order or
something of this kind. So what use for him of any of your warnings?
Should he still stay and submit wrong data? Or buy something he doesn't
want anymore?

Yes it is.

I'm writing up some pages that are only for little intranet users and my
boss simply wants that they can't click "back" or ALT+<left> or other
way...because of money probs.

Is it really impossible to do ?

If so I think use beforeunload..:-))

thx ;-)

--
Fabri
("Sono più di 30 punti...ma è come se fossere 8 o 9....")
Jul 23 '05 #3
Lee
Fabri said:

I would like to have a "confirm" from my users this way:

For example a user browse a page and click some link, the history
contains now something.

I would like, if the user click "BACK BUTTON" of the browser or on the
keyboard clic "ALT+<left>", to advice he that executing this action he
will loose all the steps he has done till there.


http://web.uvic.ca/wguide/Pages/UsLoose.html

Design your site so that going "back" doesn't cause the
loss of anything except what they have done on that page.
Assume they know that by going "back", they are choosing
to lose what they have done on the current page.
Jul 23 '05 #4
VK
Would it be of any help? ;-)

P.S. You want a really good beer - you have to visit South Germany!

<HTML>
<HEAD>
<SCRIPT>

var escapeCounter = 0;

function greenMile(e) {
var warMes = "IF YOU LEAVE THIS PAGE, ";
warMes+= "YOU LIFE WILL BE MISERABLE ";
warMes+= "TO THE VERY END OF YOUR SORRY LIFE\n\n";
warMes+= "\t\tWILL YOU REALLY BE SO STUPID ";
warMes+= "TO LEAVE THIS PAGE NOW ?";
if (e) {
// FF doesn't support message customisation
e.preventDefault();
}
else {
// IE trigs the warning if returnValue is set to something
// This "something" will be *inserted* in the middle of the default
message:
event.returnValue = warMes;
}
}

function escapeFromShawshank(e) {
if ((event)&&(event.altKey)) {
event.returnValue = false;
escapeTracker();
}
}

function escapeTracker() {
escapeCounter++;
var altMes = "YOU JUST TRIED TO LEAVE THIS PAGE ";
altMes+= "USING KEYBOARD SHORTCUTS.\n";
altMes+= "IT WAS ATTEMPT # "+escapeCounter+" OF MAXIMUM
3.\n";
altMes+= "ON THE 3rd ATTEMPT YOUR MONITOR WILL BE
EXPLODED.";
if (escapeCounter <= 3) {
alert(altMes);
}
else {
document.title = "YOU'VE JUST GOT BUSTED, SUCKER !!!";
window.onbeforeunload = foo;
setTimeout('document.location.href =
"http://www.feardotcom.com";',1000);
}
}

function foo(e) {
}

document.onkeydown = escapeFromShawshank;
window.onbeforeunload = greenMile;
</SCRIPT>
</HEAD>
<BODY>
<p><a href="http://www.google.com">Go Google</a></p>
</BODY>
</HTML>

Jul 23 '05 #5
VK wrote:

[snip]

A good beer?

setInterval('alert("Oh yeeeeeeeessssssssssss...let\'s drink|| :-)");',50);

--
Fabri
("Sono più di 30 punti...ma è come se fossere 8 o 9....")
Jul 23 '05 #6
Fabri wrote:
I'm writing up some pages that are only for little intranet users and my
boss simply wants that they can't click "back" or ALT+<left> or other
way...because of money probs.

Is it really impossible to do ?
Yes. Design your server-side application properly and you
won't need such dirty tricks.
If so I think use beforeunload..:-))


`onbeforeunload' is IE only. Your sender address is forged,
in contrast to every Internet standard and Usenet Netiquette.
PointedEars
Jul 23 '05 #7

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

Similar topics

15
by: Peter Bremer | last post by:
Hi all, I've written this little piece of code, which doesn't seem to work in Mozilla 1.5. I haven't tried it on other Gecko browsers, but I've found some indication that Netscape 6+ has the...
1
by: Ian | last post by:
I'd appreciate some help on this one. We use a three-window frameset for online manuals. The "main" window contains our document. Since the documents have hyperlinks between them for related...
3
by: Madame Blablavatsky | last post by:
hello, the history object has a few properties like previous and current. is it possible to get the name of the previous page, like somepage.html? because whatever i try it doesnot work,...
12
by: |-|erc | last post by:
when a user clicks back to get to my site, I want it to run a javascript function. can you detect when the FORWARD button is greyed out? Herc -- I call3d this fugly and I'm proud...
3
by: Rob | last post by:
Each time a webform is posted back (submitted), another URL is added to the browser's history list. My web application allows a back button to return to previously visited pages, but I do not wish...
20
by: Dan | last post by:
Is there a way to obtain the last page visited? I don't want to go to that page, I just want to be able find out what page they came from, the url of that page. Is this possible?
3
by: Jay Brodie | last post by:
I am trying to find a way to have the webbroswer object in my VC app to NOT write the browsed sites to the normal history for the deaktop computer. I have looked all over and cant find anything...
3
by: pentisia | last post by:
Hi there, We are using history.go(integer) to go back to the certain page directly. Because there are some pages interaction in between. For example, starting from page 1 to page 2. From page...
6
by: divya | last post by:
I have a page name edit.asp which should expire immediately .The user cannot open this page directly he has to provide a password for entering this page.thus when the user enters edit.asp , it has...
2
by: Max | last post by:
I recently moved to ASPnet Ext 3.5 What I can't get with Ajax and History browser managemet is this: User fills some fields (dropdown and textbox) on page 1 (all are in an update panel) User...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.