smartino Posted June 21, 2006 Share Posted June 21, 2006 Hi Javascript guru's,I don't know if this possible as i'm a newbe to Javascript. When someone uses the X in the top right of any window I want to send a command to a page on my server when the window closes.At the moment I'm using onUnload and the javascript seems to be working with a simple alert in it. The page on the server has update commands in it to update a database but the database isn't being updated on the window closing!?!?Thanks in advance for any help.Simon. Link to comment Share on other sites More sharing options...
aspnetguy Posted June 21, 2006 Share Posted June 21, 2006 you can't update a datbase with JavaScript.what is the code that is being executed on onunload? Can you post your code? Link to comment Share on other sites More sharing options...
smartino Posted June 21, 2006 Author Share Posted June 21, 2006 you can't update a datbase with JavaScript.what is the code that is being executed on onunload? Can you post your code?<{POST_SNAPBACK}> Cheers for the reply - I'm trying to send a request to another page on close of the window. Inside that page I have code to update a database. Like I say, abit of a newbie on this and not sure if it's possible. Below is the onunload...<script language="javascript" type="text/javascript"><!--var IE = document.all?true:false;function HandleOnClose() {if (IE){ if (name){ window.location.href="goupdate.cfm?<cfoutput>#URLTOKEN#</cfoutput>" } } else { window.location.href="goupdate.cfm?<cfoutput>#URLTOKEN#</cfoutput>" }}//--></script> Link to comment Share on other sites More sharing options...
aspnetguy Posted June 21, 2006 Share Posted June 21, 2006 is the update page actually getting loaded? If so then the database updating is a problem with the update page not the page that redirects to the update page. Link to comment Share on other sites More sharing options...
smartino Posted June 22, 2006 Author Share Posted June 22, 2006 is the update page actually getting loaded? If so then the database updating is a problem with the update page not the page that redirects to the update page.<{POST_SNAPBACK}> The page isn't getting loaded and I believe that is my problem. I know the update works if the page is run. I need a method on close to run a page on my server even though the user closes their window. I could open another window then close it but I'm facing a problem with pop-up blockers!Can I call a Javascript/Function on another page that is in a window below the window that the user is closing and if so how do i do this? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now