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

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
ST3VOAsked:
Who is Participating?
 
abelConnect With a Mentor Commented:
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
 
abelCommented:
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
 
BadotzCommented:
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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
abelCommented:
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
 
BadotzCommented:
Whew! Thanks; I *hate* awaiting judgement ;-)
0
 
ST3VOAuthor Commented:
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
 
ST3VOAuthor Commented:
Thanks :o)
0
 
abelCommented:
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
 
abelCommented:
ah, you accepted while I was still typing the follow-up ;). Tx!
0
 
BadotzCommented:
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
 
ST3VOAuthor Commented:
Thanks, I'll talk to him in the morning and will post the outcome here :o)  GNight
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.