How to disbale Close(X) button in title bar

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Nov 2008
Posts: 8
Reputation: ukbasak is an unknown quantity at this point 
Solved Threads: 0
ukbasak ukbasak is offline Offline
Newbie Poster

How to disbale Close(X) button in title bar

 
0
  #1
Apr 23rd, 2009
Please anyone provides code with examle to disable the Close (X) button in title bar. If user wants to click automatically a dialog box must appear with message 'This is disbale'...

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,326
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 162
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to disbale Close(X) button in title bar

 
0
  #2
Apr 23rd, 2009
Immediate thought

Malware
you cant close this page unless you buy something
your pc is infected send us money
You are not supposed to take control of the browser
Imagine if you could not close a web browser when you went to some site on the internet that was loading your computer full of viruses!

lookup

onclose
onunload

something like
  1. <script language="JavaScript">
  2. <!--
  3. var legalExit=0;
  4. var lpx=10;
  5. function leave() {
  6. if(legalExit==0) {
  7. var dl=confirm('WARNING: Closing this window means bla bla bla.\n\nClick OK to remain.');
  8. if(dl) {
  9. if(window.screen){
  10. lpx=screen.width;lpx=lpx-225;
  11. }
  12. var op=window.open('filename','','width=170,height=185,location=no,status=no,directories=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no,top=10,left=' + lpx);
  13. }
  14. }
  15. }
  16. function openWin(u,t,x,y,s) {
  17. var op=window.open(u,t,'width='+x+',height='+y+',location=no,status=yes,toolbar=no,directories=no,menubar=no,scrollbars='+s+',resizable=no');
  18. op.focus();
  19. }
  20. // -->
  21. </script>
code is untested, just thought process
Last edited by almostbob; Apr 23rd, 2009 at 10:51 am.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 8
Reputation: ukbasak is an unknown quantity at this point 
Solved Threads: 0
ukbasak ukbasak is offline Offline
Newbie Poster

Re: How to disbale Close(X) button in title bar

 
0
  #3
Apr 24th, 2009
Thanks almostbob...

But this does not help me much. My browser window will contain all features as menubar, addressbar, standard button all... but this browser should not allow the user to close on clicking close (X) button. at time time a pop up massage appears with 'User cannot click on this Close Button'. the user must select the logOut menu to sign out.

Please send the code if you have.

Thanks -- ukbasak
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 217
Reputation: mail2saion is an unknown quantity at this point 
Solved Threads: 32
mail2saion's Avatar
mail2saion mail2saion is offline Offline
Posting Whiz in Training

Re: How to disbale Close(X) button in title bar

 
0
  #4
Apr 26th, 2009
YOU CAN TRY WITH BELOW SCRIPT.
JUST PASTE THE BELOW SNIPPET WITHIN HEAD TAG:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. window.onbeforeunload = confirmExit;
  2. function confirmExit()
  3. {
  4. if (window.event.clientY < 0 && window.event.clientY < -80)
  5. {
  6. return 'You will be logged out.';
  7. // You can set return false here.
  8. }
  9. }
MARK AS SOLVED if its help you.

REGARDS
MCTS - Shawpnendu bikash maloroy
http://shawpnendu.blogspot.com
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,326
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 162
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: How to disbale Close(X) button in title bar

 
0
  #5
Apr 26th, 2009
Perhaps look into sessions, no experience to offer but.,,
it
logs them out of the server after time of no activity
whether they click the bye-bye button or no
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC