Click here to Skip to main content
14,929,655 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,
In my Application , One View Linkbutton in gridview or out side the gridview , When clicking on the view linkbutton open the new window popup. The problem is when we can close the window or does not close. If we Refresh the browser, it will open a new window . How to restrict open new window again.
I am using javasciprt ,write code for new window.
Posted
Updated 19-Jul-12 19:58pm
v2
Comments
Sandeep Mewara 20-Jul-12 1:36am
   
Not clear.
Vani Kulkarni 20-Jul-12 2:30am
   
Please elaborate your question.
Rajesh Varma Buddaraju 20-Jul-12 4:57am
   
If possible post your sample code here.

if you open pop-up window using javascript by window.open funtion than in pop-up window your are not able to view address bar,menu etc so you can not click on refresh button becuase its not visible...but you can refresh page by pressing F5 key so write following block in script tag of .aspx page...

// Write following code of block in script tag like
<script type="text/javascript">
C#
document.attachEvent("onkeydown", my_onkeydown_handler);
window.history.forward(1);
document.attachEvent("onkeydown", my_onkeydown_handler);


C#
function my_onkeydown_handler() {
 switch (event.keyCode) {

      case 116: // 'F5'
          event.returnValue = false;
          event.keyCode = 0;
          window.status = "We have disabled F5";
          window.event.cancelBubble = true;
          break;
      }
  }


</script>

its solve your problem....
   
v2
Comments
CH Guravaiah 25-Jul-12 1:50am
   
thanks,It is working for f5 button only. not for refresh button . At the same time refresh button also work.
You're saying if you do a refresh, it shows the popup again ? I assume this means you're doing something dodgy that requires a postback to show the window ? To stop a refresh from performing the postback again, do a Response.Redirect back to the same page, so the browser goes a GET instead of a POST. But, if you do that, it will stop your code from emitting the JS that it only emits on a POST, so perhaps you just need to fix your code so it doesn't do a postback to show a popup.

If that's not what you mean, you need to explain it better.
   

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