|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
onload event doesn't workI 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 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 Well, probably it will not work for me.> 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. Has she Active Scripting enabled for either Security Zone?> > 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 As a result of its built-in popup blocker, Norton _InSecurity_ probably> add-ons (especially supplied by dell) that might cause this behaviour? 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.javascript PointedEars ___________ [1] <URL:http://www.iks-jena.de/mitarb/lutz/usenet/Firewall.en.html> Thomas 'PointedEars' Lahn said the following on 12/16/2005 6:24 AM:
> Andy Fish wrote: I will try to explain this to you as simple as can be so that maybe you > > >>I have an asp.net web application which uses a pop-up form > > > What is a "pop-up form"? 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 As well it may not work for a lot of people that have window.open >>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. disabled or it is not present for some other reason. > Indication 1: "other javascript on the site seems to work fine" >>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? > 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 NIS doesn't block popups by disabling the onload, it disables popup >>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. 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 Hmmm. You open a popup, you close that popup. There is no "window > user is presented a security confirm box that is there in order to protect > her from losing her window history. 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 Where did you come up with that Rubbish?> 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 But totally 100% irrelevant to anything but your diatribe about NIS.> 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, More Rubbish that is irrelevant to the question.> that is, do not suppose anything to work regarding this without their direct > interaction (and the `onload' event handler does not classify as such). > microsoft.public.dotnet.framework.aspnet added back as it should have > Followup-To comp.lang.javascript been left alone to start with. More irrelevant rubbish. -- Randy comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/ Andy Fish wrote:
> Is there a better way to achieve the result I'm after (i.e. posting a form There is another approach. First, have a hidden iframe in your main> and having the window close as soon as the data is posted) other than using > an onload event to do window.close? 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=receptacle id=myform ...> Finally, right after submitting the form via javascript, close the window: .... document.getElementById('myform').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 |
|||||||||||||||||||||||