HI
I am trying to use the window onunload event, so that when a user closes the window it will go and delete a text file that it uses to read contents from, so to stop my server filling up with loads of text files.
But i have problem that it will go and delete a file if i push a button as it considers moving away from that page as an onunload event.
i am trying to write the function so that it can detect wether the button has been pushed or if the window has been closed
I have written the following function
if i push the button it says the button pushed and if i close the window it says button pushed, so its obviously not working.
any ideas?
cheers
Boyindie
I am trying to use the window onunload event, so that when a user closes the window it will go and delete a text file that it uses to read contents from, so to stop my server filling up with loads of text files.
But i have problem that it will go and delete a file if i push a button as it considers moving away from that page as an onunload event.
i am trying to write the function so that it can detect wether the button has been pushed or if the window has been closed
I have written the following function
Code:
]function deleteFile()
{
var button1 = document.getElementById('result').click=true;
var button2 = document.getElementById('manual').click=true;
if (button1||button2)
{
alert("button pushed")
}
else
{
var q = new Query();
if (q.file!=null)
{
if (q.url!=null)
{
var file=q.file;
var url = q.url;
var link="a url";
window.opener.location=link;
}
}
}
}
any ideas?
cheers
Boyindie
Comment