Solved

Cancel Refresh

Posted on 2004-08-27
15
820 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

739 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