Solved

Cancel Refresh

Posted on 2004-08-27
15
815 Views
Last Modified: 2008-01-09
Dear all,

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

    Thanks,

    Mazen
0
Comment
Question by:Mazen
  • 4
  • 2
  • 2
  • +5
15 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 11914118
what do you mean by cancel?  do you mean disable it so that it can't be clicked?  you can't do that.
0
 
LVL 19

Expert Comment

by:peh803
ID: 11914172
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
 
LVL 1

Author Comment

by:Mazen
ID: 11914184
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
 
LVL 1

Author Comment

by:Mazen
ID: 11914233
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
 
LVL 33

Expert Comment

by:knightEknight
ID: 11914261
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
 
LVL 19

Expert Comment

by:peh803
ID: 11914307
@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
 
LVL 49

Expert Comment

by:Roonaan
ID: 11915385
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Comment

by:Mazen
ID: 11916241

   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
 
LVL 1

Expert Comment

by:BillyBoJimBob
ID: 11917326
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
 
LVL 1

Expert Comment

by:BillyBoJimBob
ID: 11917342
If you've successfully disabled the F5 key, it makes sense that you could add your F11 button to the list.
0
 
LVL 19

Expert Comment

by:RanjeetRain
ID: 11917724
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
 
LVL 13

Expert Comment

by:davidlars99
ID: 11918702
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
 
LVL 1

Author Comment

by:Mazen
ID: 11919492
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
 

Accepted Solution

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now