inutan
inutan

Reputation: 10888

ASP.Net - Safari alert - Are you sure you want to leave this page?

Asp.Net application 1 - webpage contains a hyperlink, say ShowReport
ASP.Net application 2 - webpage Download.aspx

In app 1, When ShowReport link is clicked, I open the page Download.aspx(hosted in a separate web-site) to show the save/download dialog box to user:

ShowReport.href = [http://localhost:19515/Download.aspx]

In app2 - Download.aspx, I have something like:

            Response.ClearHeaders();  
            Response.ClearContent();  
            Response.Clear();  
            Response.ContentType = contentType.GetFriendlyName();  
            Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}", file.Name));  
            Response.AddHeader("Content-Length", file.Length.ToString());  
            Response.TransmitFile(filePath);    

But while runnning app in Safari, when ShowReport link is clicked, I get an alert saying
'Are you sure you want to leave this page? You have unsaved changes. Click OK to leave or Cancel to stay'

Can anyone please guide me how can I get rid of this alert.

Thank you!

Upvotes: 0

Views: 1458

Answers (1)

Genius
Genius

Reputation: 1782

You have onbeforeunload event handler somewhere there that returns a part of this message. Get rid of this first.

Upvotes: 1

Related Questions