 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 17th, 2004, 03:16 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Disable all controls on a pop-up window
Hello all,
I was wondering if anyone knew how to disable the minimize and more importantly the close "X" buttons in the upper right hand corner of a pop-up window.
Thanks for the help,
Jim
|
|

August 17th, 2004, 03:46 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
No, not possible. Consider the security ramifications if you could open a window that the client couldn't close.
Mozilla provides signed scripts for such functionality, but it's proprietary to the Gecko browser. Read my responses to this thread:
http://p2p.wrox.com/topic.asp?TOPIC_ID=16522
Alternatively you can use CSS and layering to simulate a popup window, the content can either be included directory in the document or called using an inline frame. The caveat is the layer cannot leave the window calling it and when the browser window is closed, the layer of course goes with it.
Regards,
Rich
--
[ http://www.smilingsouls.net]
[ http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
|
|

August 17th, 2004, 03:53 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Thanks, I didn't think I could.
Is it possible in code to stop the user in the OnUnlod event? Or does this go back to your security comment?
|
|

August 17th, 2004, 03:56 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
BTW such functionality is generally referred to as a "chromeless" window, the chrome refers to the browser controls, window border, close, minimize, etc.
Regards,
Rich
--
[ http://www.smilingsouls.net]
[ http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
|
|

August 17th, 2004, 03:57 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
Why do you need to prevent the user from closing the window?
Regards,
Rich
--
[ http://www.smilingsouls.net]
[ http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
|
|

August 17th, 2004, 04:02 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
if they close the window without submitting, it can cause data issuse in the DB. I can't make the window modal because they need to move between the pop-up and calling window
|
|

August 17th, 2004, 04:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
Have you tried submitting the form onunload? I don't know if that works. You can force a confirmation dialouge onunload.
If you have the possibility of a DB being effected, such as fields across multiple tables where each must have rows with corresponding ids, I would suggest that you create all of those rows up front, and then if the user closes a window before completing steps in the submission, you can write a script to resume at the same place when the user comes back by detecting what fields exist and contiain data. (Just guessing at the scenario of course) Thing is it's better to anticipate the user closing the window than trying to stop them from doing it, e.g. anything that can go wrong will!
HTH!
Regards,
Rich
--
[ http://www.smilingsouls.net]
[ http://pear.php.net/Mail_IMAP] A PHP/C-Client/PEAR solution for webmail
|
|

August 17th, 2004, 04:18 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
I tried submitting on OnUnLoad however there would be no way for me to validate data, also, if they do hit Submit, there will be 2 rows in the table.
I guess I just need to stress to the users to be sure to Submit. But you are correct, what ever can go wrong will.
Thanks for your help!!
Jim
|
|

April 12th, 2007, 10:06 AM
|
|
Registered User
|
|
Join Date: Apr 2007
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorta the same topic we need to disable all browser functions when opening a window. This is for a corporate app and security wise want the printing, save, cut, copy, alt, ctl. Fkeys essentually everything shut off. We are converting everything to a graphic file so no highlighting will work.
Consider this an IE project.
B
|
|

April 12th, 2007, 10:24 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
|
|
You can disable to your heart's content, but keep in mind the user can go around all of that and get the content directly from the cache. This is even easier to do in IE. You can disable the cache too, but in that case the user can disable script and just access the content directly.
You can make it difficult, but it's not impossible to work around disabling those controls. Any content rights management in a browser that you hope to attain is an illusion and should be treated as such.
You also don't need to convert to a graphic to prevent selection.
Code:
window.onselectstart = function()
{
window.event.returnValue = false;
};
Regards,
Rich
--
Author,
Beginning CSS: Cascading Style Sheets For Web Design, 2nd Edition
CSS Instant Results
http://www.catb.org/~esr/faqs/smart-questions.html
|
|
 |