Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

stop refresh

Posted on 2001-06-25
12
Medium Priority
?
535 Views
Last Modified: 2008-03-17
Is there a way to stop the user from refreshing the page.
1) disable F5
2) stop refresh using context menu

The cancelBubble property works for disabling the opening of a new window using "CtrlKey + N".

Please do throw some light on this property too ( when it works and when it doesn't )

rgds
jcs
0
Comment
Question by:jcs_clement
[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
  • 6
  • 5
12 Comments
 
LVL 1

Expert Comment

by:katyan
ID: 6226444
listening
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6226578
Check this. It prevent the user from right click and also prevents refresh by F5. Still the user has the option of
refreshing the page from main menu. So you need to open a new window without any of these menus.

Hope this helps !!!!

<html>
<head>
<script language="JavaScript1.2">
function keyPressed(evt) {
   var F5 = 116;
   if(document.layers) {
             if (evt.which == F5) {
              return false;
           }
   }else if(document.all){
          if (event.keyCode == F5) {
               event.keyCode = 0;
                window.event.returnValue = false;
             }
   }
}

function click(e) {
     if (document.all) {
          if (event.button == 2) {
               alert("Sorry, that function is disabled");
               return false;
          }
     }
     if (document.layers) {
          if (e.which == 3) {
               alert("Sorry, that function is disabled");
               return false;
          }
     }
}

if(document.layers){
     window.captureEvents (Event.KEYDOWN);
     document.captureEvents(Event.MOUSEDOWN);
     window.onkeydown=keyPressed;
     window.onmousedown=click;
}else{
     document.onkeydown=keyPressed;
     document.onmousedown=click;
}
</script>
</head>


<body>

</body>
</html>
0
 
LVL 4

Author Comment

by:jcs_clement
ID: 6226600
Great one !!.
The context menu in NS 4.7 does not throw an alert when I right click. Can u please check that one and let me know ?

rgds
jcs
0
Technology Partners: 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!

 
LVL 9

Accepted Solution

by:
nimaig earned 200 total points
ID: 6226625
Sorry ... I forgot to test in Netscape. This code should work.

<html>
<head>
<script language="JavaScript1.2">
function keyPressed(evt) {
   var F5 = 116;
   if(document.layers) {
             if (evt.which == F5) {
              return false;
           }
   }else if(document.all){
          if (event.keyCode == F5) {
               event.keyCode = 0;
                window.event.returnValue = false;
             }
   }
}

function click(e) {
     if (document.all) {
          if (event.button == 2) {
               alert("Sorry, that function is disabled");
               return false;
          }
     }
     if (document.layers) {
          if (e.which == 3) {
               alert("Sorry, that function is disabled");
               return false;
          }
     }
}

if(document.layers){
     document.captureEvents(Event.MOUSEDOWN);
     document.captureEvents (Event.KEYDOWN);
}
document.onkeydown=keyPressed;
document.onmousedown=click;
</script>
</head>


<body>

</body>
</html>
0
 
LVL 4

Author Comment

by:jcs_clement
ID: 6226647
Great one !!.
The context menu in NS 4.7 does not throw an alert when I right click. Can u please check that one and let me know ?

rgds
jcs
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6226648
Hi,
I am using Netscape 4.7 and the code works fine.

Nimai
0
 
LVL 4

Author Comment

by:jcs_clement
ID: 6226651
Thanks great one !!

rgds
jcs
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6226671
Hi jcs,
 Thanks :) Are you in Planetasia, Kormangala office(Near Aztec software). I am also working in a company in Kormangala itself.
 
 Nimai
0
 
LVL 4

Author Comment

by:jcs_clement
ID: 6226690
Yeah u are right. Where are u now...?

rgds
jcs
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6226725
I am working in Wisor Telecom.
0
 
LVL 4

Author Comment

by:jcs_clement
ID: 6226813
Hi will u give me your mail id ..?
Lets' keep in touch.
Mine is jcs_clement@yahoo.com

rgds
jcs
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6226840
Hi jcs,
Thanks for you mail Id.
You can mail me at this mail Id.
nimaig@yahoo.com

Nimai
0

Featured Post

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.

Question has a verified solution.

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

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…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

609 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