473,698 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1401
VK
You have the same onbeforeunload event that was already discussed here:
<http://groups-beta.google.com/group/comp.lang.javas cript/browse_frm/thread/9e071a9d1bfb53a f/4e2c7c20e3047eb 2#4e2c7c20e3047 eb2>

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.javas cript/browse_frm/thread/9e071a9d1bfb53a f/4e2c7c20e3047eb 2#4e2c7c20e3047 eb2>

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.preventDefaul t();
}
else {
// IE trigs the warning if returnValue is set to something
// This "something" will be *inserted* in the middle of the default
message:
event.returnVal ue = warMes;
}
}

function escapeFromShaws hank(e) {
if ((event)&&(even t.altKey)) {
event.returnVal ue = 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.onbefore unload = foo;
setTimeout('doc ument.location. href =
"http://www.feardotcom. com";',1000);
}
}

function foo(e) {
}

document.onkeyd own = escapeFromShaws hank;
window.onbefore unload = 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('al ert("Oh yeeeeeeeessssss ssssss...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
7288
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 same problem. Internet Explorer 6 and Opera 7 have no problems with it. <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.1//EN' 'http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd'> <script>document.write (window.history.length);</script>
1
2788
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 topics, we have "return" links built into a navigation bar on some of the pages. Most of the time these work fine, but if the person clicked on the top or left frame before clicking on the "return" link, the wrong frame is changed. Does anybody...
3
1594
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, from all the properties i only get a number from history.length.
12
3365
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 www.supernerd.com.au/~gray77/kath1.jpg
3
10016
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 to return to each Postback URL, but rather only the initial page URL. Is there a way to prevent Postback URL's from being added to the browser's history list Thanks in advance for any help.
20
3627
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
1445
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 remotly close to what I need. Can someone shed some light on this for me? Or am I wasting my time looking? TIA
3
3866
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 2, it will reload sometime, or go to page 3 and then go back to page 2 again. If we use history.back, it will only go back to the previous page. So, we have to use history.go in order to go back to page 1 correctly. But there is some problem...
6
5072
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 a button EDIT ,which when user clicks directs him to another page (done.asp). Now the problem is that from this page (done.asp) if he clicks on the back button on the toolbar then edit.asp opens.But I don't want it to open It should show page...
2
3312
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 clicks Submit Button I write the data into a DB I add a history point with ScriptManager to be able to get back to this point with browser back button Page 2 is loaded with a response.redirect() command
0
8680
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7738
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.