?
Solved

ctrl-w closing browser instead of popup window (GreyBox)

Posted on 2009-04-19
11
Medium Priority
?
1,373 Views
Last Modified: 2012-06-27
Hi all,

I am using GreyBox to popup windows on my website and if works fine.
There is just a problem when I use CTRL-W, which will normally close a normal popup window or tab etc... BUT in this case when I try to close the popup using CTRL-W it just closes the browser.

How can I fix this problem please?

thx

st3vo
0
Comment
Question by:ST3VO
  • 5
  • 3
  • 3
11 Comments
 
LVL 39

Expert Comment

by:abel
ID: 24180915
The GreyBox popup windows are javascript popup windows, they are not normal popup windows. That means, that they do not block access to the underlying page (an advantage) and they are not blocked by popup-blockers (another advantage). Also, if users prefer, when they close the tab, they will close the page and the popup-window (because the popup window is actually javascript and thus part of the page) (another advantage).

So, Ctrl-W will close the browser or tab, depending on what type of browser you have. It cannot possibly close the popup window, because the browser doesn't even think it is a popup window. To the browser, the popup window is just a part of the page (and actually, it is).

> How can I fix this problem please?

you cannot, I'm sorry. Or you should choose another technique that uses normal popup windows, but then you loose all the advantages of using javascript style popup windows.
0
 
LVL 39

Accepted Solution

by:
abel earned 2000 total points
ID: 24180943
Btw, to a certain extend you can define your own action, like dismissing that javascript fake popup window, by registering to key-down / press events. The following is possible:

Firefox: only Ctrl-W can be captured, Ctrl-F4 cannot
Internet Explorer: only Ctrl-W can be captured, Ctrl-F4 cannot
Opera: both Ctrl-W and Ctrl-F4 can be captured

Alt-F4 can never be captured (closes whole browser).

Information over keyup/down etc events and which ones you can use and how to register thme is here: http://www.quirksmode.org/js/keys.html

-- Abel --
0
 
LVL 29

Expert Comment

by:Badotz
ID: 24181025
My apologies to abel-san; I mean no offense. Pardon my speaking for you. If I am wrong, I willingly submit to your swift, merciful judgement.

Just for clarification: When [abel] says, "The GreyBox popup windows are javascript popup windows", he means the popup "window" is a collection of HTML elements (<div></div>, <span></span>, etc.). That is why they do not respond as true windows, because they are a different animal.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 39

Expert Comment

by:abel
ID: 24181062
tx for clarifying that in clearer language, Badotz, no need to apologize :)

Indeed, that's what I meant. In this case, btw, the contents is a combination of some layout elements and an iframe for loading the external content..
0
 
LVL 29

Expert Comment

by:Badotz
ID: 24181072
Whew! Thanks; I *hate* awaiting judgement ;-)
0
 

Author Comment

by:ST3VO
ID: 24181094
Thanks all.

I agree in the advantages of using js popup, but I have a small issue which is that I need to convince the site owner (who uses ctrl-w) all the time and thinks that everyone does (well I never use it!) that js popups will be better that normal popups. I've already implemented it on he's website and he said that if I couldn't fix the issue to bin it and do it another way (which I don't really want to do), so how can I convince him that not everyone uses ctrl-w...hehehhe...or that the ctrl-w issue is not a MAJOR thing? I don't really want to redo everything :o( Also, I like js popups!
0
 

Author Closing Comment

by:ST3VO
ID: 31572047
Thanks :o)
0
 
LVL 39

Expert Comment

by:abel
ID: 24181123
Your site owner is just like any other site owner: not knowing much about the internet, usability, and/or his clients. That's not necessarily bad, but they should trust the judgment of their system engineers and other it personnel. It is a great step that you managed to convince your site owner to get this far.

I've been in the Internet world since before its real takeof and started working with it professionally since 1993. Maybe you can call me half-blind, but it's honestly the first time I encounter someone using Ctrl-W (Ctrl-F4 ok, but not Ctrl-W, I don't know why, usually I'm quite good with all kinds of key combinations, even on Windows).

Well, here's the good news: on most browsers you can catch Ctrl-W.

And here's the bad news: you should not go down that path. You make your internet site/application less accessible to many users and they will be annoyed that you try to prevent them from closing the window.

Now, some other good news. You can tell your site owner that the reason for using js popups was to lessen the annoyances of having to click them away, even when you just want to close the browser. Now you don't have to click them away anymore if you want ot close the browser.

Changing that behavior is effectively the same as changing it back to old behavior: having a popup in the way and needing extra clicks/steps to move away. Don't do it. Keep it simple. For you, and for your users.

If your site owner doesn't budge, show him/her this post. If that still doesn't help, implement the Ctrl-W hack, but only for his IP address ;-)

-- Abel --
0
 
LVL 39

Expert Comment

by:abel
ID: 24181129
ah, you accepted while I was still typing the follow-up ;). Tx!
0
 
LVL 29

Expert Comment

by:Badotz
ID: 24181167
You can also throw the "increased security" bone to your site owner, since you can use JS popups EVEN WITH THE POPUP BLOCKER ON!!
0
 

Author Comment

by:ST3VO
ID: 24181241
Thanks, I'll talk to him in the morning and will post the outcome here :o)  GNight
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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
Suggested Courses

864 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