I have this code in .aspx page: (it prevents page from responsing without confrim)
<script type="text/javascript">
window.onbeforeunload = confirmExit;
function confirmExit() {
return 'آیا مایل به خروج از صفحه هستید؟';
}
</script>
I want to download a file with below code and I need to run a javascript code to disable upper code but my javascript code don't work.
ScriptManager.RegisterStartupScript(this, typeof(Page), "DisableOnbeforeunload", " window.onbeforeunload = '';", true);
Response.Redirect("doc1.docx", false);