• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 831
  • Last Modified:

Cancel Refresh

Dear all,

  How can I cancel the refresh button from the explorer for a certain page?

    Thanks,

    Mazen
0
Mazen
Asked:
Mazen
  • 4
  • 2
  • 2
  • +5
1 Solution
 
knightEknightCommented:
what do you mean by cancel?  do you mean disable it so that it can't be clicked?  you can't do that.
0
 
peh803Commented:
generally, it's a bad idea to mess around with the standard i.e. user interface .. a common question is "How do I disable the back button?"

The correct answer, however, is not to disable it, but rather to see what your problem is (i.e., why do you want to disable it in the first place??) and fix it from there.  

So, I answer a question with a question -- why do you want to disable the refresh button?

regards,
peh803
0
 
MazenAuthor Commented:
Thanks, I found the solution

<script language="JavaScript1.2">

if (document.all){
document.onkeydown = function (){
var key_f5 = 116; // 116 = F5

if (key_f5==event.keyCode){
event.keyCode = 27;

return false;
}
}
}


   I'll delete this question.

       Mazen

</script>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
MazenAuthor Commented:
I am sorry I didn't see your comments. if you have any questionss, let me hear them before I ask the moderators to delete this question.


         Mazen
0
 
knightEknightCommented:
you can delete it ... but I am curious about the code you posted.
It looks like it will disable the F5 key, but I don't think that will prevent anyone from clicking on the refresh button with the mouse -- am I right?
0
 
peh803Commented:
@knightEknight:

yes, that is correct, this only cancels F5 refreshes.  Users could still right click --> refresh from contextual menu, click the refresh button in the toolbar, or click the "refresh" option from the "view" menu.

peh803
0
 
RoonaanCommented:
A wild guess suggests that Mazen is trying to build some kind of flooding protection, otherwise I cannot find any use for this script?
0
 
MazenAuthor Commented:

   I have actually cancelled the right click from the page and I am opening the page as full screen (actually a requirement for my application), so basically I have prevented the user from refreshing the page unless I want to do so.  Your guesses are some how right, what I am trying to do is preserve the information in the page. If the user refreshes, then the data will be lost in my browser. I know I could save my variables in the session, but refilling the variables again is very messy so I was thinking of disabling refreshing as an alternative.

  Thank you all for your comments,

          Mazen
0
 
BillyBoJimBobCommented:
Mazen,

If a page is full-screen, can't you just hit F11 to toggle full screen to regular?  
When this happens, a refresh toolbar icon will be available.
0
 
BillyBoJimBobCommented:
If you've successfully disabled the F5 key, it makes sense that you could add your F11 button to the list.
0
 
RanjeetRainCommented:
Big deal. I can do a <Ctrl> + N (to open a new window) and then click on REfresh.

The lesson: Disable <Ctrl> + N as well...
0
 
davidlars99Commented:
you can use onunload even in body, but this only executes code that's inide and refreshes the page that's as far as you can go...
0
 
MazenAuthor Commented:
My application is actually HTA, so I prevented the toolbar from appearing and I cancelled all events with CTRL, but I had this small problem with the F5 button, I was only missing the code I posted above. Thank you all for your suggestions.

    Mazen
0
 
ee_ai_constructCommented:
Question answered by asker or dialog valuable.
Closed, 500 points refunded.
ee_ai_construct (replacement part #xm34)
Community Support Admin
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 4
  • 2
  • 2
  • +5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now