Solved

Cancel Refresh

Posted on 2004-08-27
15
817 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my daily work (mainly using ASP.net), I need to write a lot of JavaScript code. One of the most repetitive tasks I do are the jQuery Ajax calls. You know: (CODE) I don't know if for you it's the same, but for me is soooo tedious to write the …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

832 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