Click here to Skip to main content
15,895,537 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I have an aspx page1 with two buttons.
If i click on first button,a popup window will open.
After closing popup window, if i click on second button page will redirect to another aspx page2.
Now if i click back button in page2, it is displaying page1 and also popup window.
Please, tell me how to prevent popup window on clicking back button.
Posted
Comments
Sergey Alexandrovich Kryukov 5-Dec-12 0:57am    
Are you sure it's a pop-up window? It looks like something like modal box (or whatever looking like a windows) withing the same browser window...
--SA
Prabhakar kodavali 5-Dec-12 0:59am    
I tried window.history.forward(-1) in page1 to disable back button. But it didn't works.
I tried to remove cache of the page1, but it is showing "webpage expires".
I want after closing the popupwindow on page1, if i click on back button in page1 it should reloads the page1. but it is reloading page1 and also popup window.
choudhary.sumit 5-Dec-12 1:35am    
what is button1 codebehind?

1 solution

If it a normal browser alert, then you cannot do that.
If the popup is one Modal one created in jQuery, then you can restrict the previous page load by the following code.
XML
<script type="text/javascript" language="javascript">
if (window.history.forward(1) != null)
{
     window.history.forward(1);
}
</script>

If you really want to do that, then try to add one jQuery Modal popup instead of browser alert box.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900