473,769 Members | 1,917 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

onload event doesn't work

Hi,

I have an asp.net web application which uses a pop-up form that works a bit
like a dialog box. when the user clicks "OK" it does a postback (basically a
form post if you don't know .net) to save the contents of the form, and then
I put an onload event to do a window.close.

this works fine for hundreds of people on different browsers. However, for
one user the window does not close.

The user has a brand new PC from Dell with Norton Internet Security and is
using IE. other javascipt on the site seems to work fine. She has tried
adding the site to her IE "trusted sites" list with no effect. We have tried
enabling javascript errors in IE and none are shown.

Does anyone know of any settings in NIS or any other browser security
add-ons (especially supplied by dell) that might cause this behaviour?

Is there a better way to achieve the result I'm after (i.e. posting a form
and having the window close as soon as the data is posted) other than using
an onload event to do window.close?

TIA

Andy
Dec 16 '05 #1
5 2793
Andy Fish wrote:
I have an asp.net web application which uses a pop-up form
What is a "pop-up form"?
that works a bit like a dialog box. when the user clicks "OK" it does a
postback (basically a form post if you don't know .net) to save the
contents of the form, and then I put an onload event to do a window.close.

this works fine for hundreds of people on different browsers.
Well, probably it will not work for me.
However, for one user the window does not close.

The user has a brand new PC from Dell with Norton Internet Security and is
using IE. other javascipt on the site seems to work fine. She has tried
adding the site to her IE "trusted sites" list with no effect. We have
tried enabling javascript errors in IE and none are shown.
Has she Active Scripting enabled for either Security Zone?
Does anyone know of any settings in NIS or any other browser security
add-ons (especially supplied by dell) that might cause this behaviour?


As a result of its built-in popup blocker, Norton _InSecurity_ probably
disables the `onload' event handler by injecting code not written by you.
Furthermore "does not close" can mean anything. For example, it is likely
that the window "does not close" because the user is presented a security
confirm box that is there in order to protect her from losing her window
history. Or the security settings of IE with XP SP-2 (indicated by the
new Dell PC) simply prevent windows not opened through scripting to be
closed by scripting.

Recommending her to uninstall pseudo-security applications like NIS and
to get informed about system and network security being a Good Thing[1]
aside:

Never ever mess with browser windows without the users' explicit consent,
that is, do not suppose anything to work regarding this without their direct
interaction (and the `onload' event handler does not classify as such).
Followup-To comp.lang.javas cript

PointedEars
___________
[1] <URL:http://www.iks-jena.de/mitarb/lutz/usenet/Firewall.en.htm l>
Dec 16 '05 #2
Thanks for the response.

The user story is simple, the user clicks a link on page A which pops up
(using window.open) page B containing some form controls. the user
enters/selects the values and then clicks "OK" at which point the window
closes and the settings must be saved to the server (via a form post) and
the window closes.

If there is any way of doing this without putting window.close in the onload
event, I would be eager to find out. As fas as I'm concerned, I am closing
the window with their consent (because they clicked the OK button).

It is a prerequisite of my application that users must have active scripting
enabled and pop-up blockers disabled for this site and this is true for the
user experiencing the problem. I don't have a mind if people want to disable
JS or block pop-ups; they just can't use my application (their loss ;-)

plenty of other users (probably most) have XP SP2 and there is only one who
has this problem.
"Thomas 'PointedEars' Lahn" <Po*********@we b.de> wrote in message
news:37******** ********@Pointe dEars.de...
Andy Fish wrote:
I have an asp.net web application which uses a pop-up form


What is a "pop-up form"?
that works a bit like a dialog box. when the user clicks "OK" it does a
postback (basically a form post if you don't know .net) to save the
contents of the form, and then I put an onload event to do a
window.close.

this works fine for hundreds of people on different browsers.


Well, probably it will not work for me.
However, for one user the window does not close.

The user has a brand new PC from Dell with Norton Internet Security and
is
using IE. other javascipt on the site seems to work fine. She has tried
adding the site to her IE "trusted sites" list with no effect. We have
tried enabling javascript errors in IE and none are shown.


Has she Active Scripting enabled for either Security Zone?
Does anyone know of any settings in NIS or any other browser security
add-ons (especially supplied by dell) that might cause this behaviour?


As a result of its built-in popup blocker, Norton _InSecurity_ probably
disables the `onload' event handler by injecting code not written by you.
Furthermore "does not close" can mean anything. For example, it is likely
that the window "does not close" because the user is presented a security
confirm box that is there in order to protect her from losing her window
history. Or the security settings of IE with XP SP-2 (indicated by the
new Dell PC) simply prevent windows not opened through scripting to be
closed by scripting.

Recommending her to uninstall pseudo-security applications like NIS and
to get informed about system and network security being a Good Thing[1]
aside:

Never ever mess with browser windows without the users' explicit consent,
that is, do not suppose anything to work regarding this without their
direct
interaction (and the `onload' event handler does not classify as such).
Followup-To comp.lang.javas cript

PointedEars
___________
[1] <URL:http://www.iks-jena.de/mitarb/lutz/usenet/Firewall.en.htm l>

Dec 16 '05 #3
Thomas 'PointedEars' Lahn said the following on 12/16/2005 6:24 AM:
Andy Fish wrote:

I have an asp.net web application which uses a pop-up form

What is a "pop-up form"?


I will try to explain this to you as simple as can be so that maybe you
can understand it since English is not your native language PointedHead.

pop-up - Generally refers to a - gasp - popup window.
form - If you don't know what a form is, give up the web.

Put them together:

popup form - form in a popup window.

I know, that is a stretch for you to comprehend but try, you can manage it.
that works a bit like a dialog box. when the user clicks "OK" it does a
postback (basically a form post if you don't know .net) to save the
contents of the form, and then I put an onload event to do a window.close.
this works fine for hundreds of people on different browsers.


Well, probably it will not work for me.


As well it may not work for a lot of people that have window.open
disabled or it is not present for some other reason.
However, for one user the window does not close.

The user has a brand new PC from Dell with Norton Internet Security and is
using IE. other javascipt on the site seems to work fine. She has tried
adding the site to her IE "trusted sites" list with no effect. We have
tried enabling javascript errors in IE and none are shown.

Has she Active Scripting enabled for either Security Zone?


Indication 1: "other javascript on the site seems to work fine"
indicates that Scripting is indeed enabled. Learn to read, and
comprehend what you read, and you will go a lot further than you already
are Thomas. Your idiotic pedantics get old after a while.
Does anyone know of any settings in NIS or any other browser security
add-ons (especially supplied by dell) that might cause this behaviour?

As a result of its built-in popup blocker, Norton _InSecurity_ probably
disables the `onload' event handler by injecting code not written by you.


NIS doesn't block popups by disabling the onload, it disables popup
windows by disabling the window.open call by redefining it to return
false when called.
Furthermore "does not close" can mean anything.
No, it is simple. It doesn't close. Thats not that difficult to understand.

For example, it is likely that the window "does not close" because the
user is presented a security confirm box that is there in order to protect
her from losing her window history.
Hmmm. You open a popup, you close that popup. There is no "window
history" to lose. If the user is presented a security confirm window on
a popup that was opened by script then your UA is severely broken. And I
know of *no* UA that when you manage to open a window with window.open
that will, by default, give you a confirm box when you attempt to
execute window.close() on that window.

Or the security settings of IE with XP SP-2 (indicated by the
new Dell PC) simply prevent windows not opened through scripting to be
closed by scripting.
Where did you come up with that Rubbish?
Recommending her to uninstall pseudo-security applications like NIS and
to get informed about system and network security being a Good Thing[1]
aside:
But totally 100% irrelevant to anything but your diatribe about NIS.
Never ever mess with browser windows without the users' explicit consent,
that is, do not suppose anything to work regarding this without their direct
interaction (and the `onload' event handler does not classify as such).
More Rubbish that is irrelevant to the question.

Followup-To comp.lang.javas cript
microsoft.publi c.dotnet.framew ork.aspnet added back as it should have
been left alone to start with.
[1] <URL:http://www.iks-jena.de/mitarb/lutz/usenet/Firewall.en.htm l>


More irrelevant rubbish.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 17 '05 #4
Andy Fish wrote:
The user story is simple, the user clicks a link on page A which pops up
(using window.open) page B containing some form controls. the user
enters/selects the values and then clicks "OK" at which point the window
closes and the settings must be saved to the server (via a form post) and
the window closes.
ACK. I wondered if you meant submitting to a window from a form in another
window, e.g., hence my question.
If there is any way of doing this without putting window.close in the
onload event, I would be eager to find out.
What if you simply did not? This would help users as they would see if
submitting their data was successful or not (and they could go back and
try again if it was not). And then you included a Close button in the
response, if you thought that users cannot find or do not know the
"Close Window" feature of the used UA/window manager.
As fas as I'm concerned, I am closing the window with their consent
(because they clicked the OK button).
They clicked the OK button in order to submit data, not in order to close
the window containing the resulting response. They gave you their explicit
consent to retrieve the submitted data, not to close the window that
submitted it :)
It is a prerequisite of my application that users must have active
scripting enabled and pop-up blockers disabled for this site and this is
true for the user experiencing the problem. I don't have a mind if people
want to disable JS or block pop-ups; they just can't use my application
(their loss ;-)

plenty of other users (probably most) have XP SP2 and there is only one
who has this problem.
Then your user should disable or even uninstall NIS, which as I pointed out
would be a Good Thing anyway, and see if that helps. However, I wonder why
you do not want to let users see the result of their submit action which
would avoid this problem, too.

And please do not
[top post]


<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>

TIA.
PointedEars
Dec 18 '05 #5
Andy Fish wrote:
Is there a better way to achieve the result I'm after (i.e. posting a form
and having the window close as soon as the data is posted) other than using
an onload event to do window.close?


There is another approach. First, have a hidden iframe in your main
page looking something like this (you may need to futz with some of the
attributes. For example, you may wish to hold off on that style
setting till after you get everything else working):
<iframe name=receptacle style="display: none" src=""></iframe>

In the popup, make sure your form declaration includes a target:
<form ... target=receptac le id=myform ...>

Finally, right after submitting the form via javascript, close the
window:
....
document.getEle mentById('myfor m').submit();
window.close();

The point of this is to close the window upon submission as opposed to
waiting for the sumission to be successful. There is a danger, which
PointedEars alluded to, that the submission may not be successful for
any number of reasons. In fact, you can count on it happening from
time to time, so your app should be prepared to deal with this
situation. Oh yes, and make sure to change the text on the button from
'OK' or 'Submit' to 'Submit and close window' so nobody claims the
button does more than it promised ;).

Sometimes, windows put up a confirmation dialog when being closed by
script. You may forego a class of such confirmations by doing
window.opener = "me";
(I have encountered this when sequencing windows with VBScript).

Csaba Gabor from Vienna

Dec 18 '05 #6

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

Similar topics

2
6213
by: Bender | last post by:
Hi, I am wanting to capture an onmousedown event without firing the body tags onload event. Also, if anyone could explain why this happens that would be excellent. I can't see how an onmousedown event could bubble up to an onload event. NOTE: If you put an alert() statement in the onmousedown event handler the body onload event doesn't get fired.
2
1831
by: George Hester | last post by:
I have a page that loads an applet. It's a cube that is used as a navigation menu. This issue actually happens in both Microsoft Internet Explorer and Netscape. All versions that I know of. And also happens with the Microsoft JVM and Sun's JVM. Here's the issue: When the page loads and messages in the status bar about what the applet is doing (like applet initializing that sort of thing) finish, the result when all is said and done is...
4
4917
by: Pai | last post by:
hello there, I am trying to rersize the window it works find in IE but doea not work with mozilla window.attachEvent(onload,MWSOnLoad); window.onload = function (MWSOnLoad) { alert('hello'); window.resizeTo(810,750); top.outerWidth=810;
4
5017
by: Joe Kehnast | last post by:
I'm running a system on W2K web server with a Professional XP client. I'm opening a window from an asp page using showModalDialog. In the window I open I'm calling the onLoad event from the body tag. The very first thing I put in the beginProcessing() function is an alert saying I "got here." For some reason the event doesn't always fire and my function doesn't run. Any ideas why? I had to abandon this and came up with another...
12
19764
by: vadivasbro | last post by:
Very simple code. Why won't this work? <html> <head> <script type="text/javascript"> window.onload = document.getElementById("thisThing").style.background = "red"; </script>
2
7678
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would like mine to run immediately after it. So in the code below, what JS would i need to add to my "myfile.inc" page so that I could guarantee this behavior? <!-- main page --> <html> <head> <script type="text/javascript">
3
1896
by: Andy Fish | last post by:
Hi, I have an asp.net web application which uses a pop-up form that works a bit like a dialog box. when the user clicks "OK" it does a postback (basically a form post if you don't know .net) to save the contents of the form, and then I put an onload event to do a window.close. this works fine for hundreds of people on different browsers. However, for one user the window does not close.
2
6482
by: Martin Honnen | last post by:
I was playing around with canvas support in recent Safari, Mozilla and Opera (only version 9 preview) but run into issues with Safari related to the very old DOM Level 0 Image object for preloading images. When doing e.g. var img = new Image(); img.onload = function (evt) { alert(this); }; img.src = 'whatever.gif';
17
6444
by: B. Chernick | last post by:
I'm trying to create a web page and I need a javascript function to be called on the load of a particular panel. (The panel is hidden during some but not all postbacks.) The function is bound to the panel in VB as follows: pnlAdd.Attributes.Add("onLoad", "SetupScreenLite()") This is basically how we attach all functions in our projects but this is the first time I've worked with onLoad and the first time I've tried to
0
9579
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
10205
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
10035
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...
1
9984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9851
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
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...
1
7401
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
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...

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.