View Full Version : Damn Pop-up blocker
MattyBumBum
08-11-2006, 01:19 PM
A friend trying to view my site (with IE5 and I think XP,SP2) says he gets a "Pop-up blocked" message when he clicks on my links which look like this:
<a href="#" onMouseOut="hideddrivetip()" onMouseOver="ddrivetip(' show slide','#000078','72')" onClick="window.open('slides/03whatever.htm','500x333','width=500,height=333,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no')" style="TEXT-DECORATION: NONE"><font color="#AA0000">LINK</font></a>
As you can see I'm using a DHTML Tooltip script from this place, and I'm being a bit fussy about the appearance of my LINK, but I really can't see why the Pop-up blocker has anything to do with my window.open command.
To add to the hurt, my friend says his Pop-up blocker is off.:confused:
Hayulp!
blm126
08-11-2006, 02:27 PM
window.open does open a popup. If you want to use a DHTML popup I think there are several in the Dynamic Drive library.
Well his popup blocker is evidently not off.
This is exactly why popups shouldn't be used for important content.
jscheuer1
08-11-2006, 07:54 PM
Well, if friend's pop up blocker settings are set to the more aggressive end of the spectrum of choices, there isn't much you can do. But, if friend has Google tool-bar with, or just average settings, you might still be able to get it to work. Name your window a word, not a number. Change the href from "#" to "javascript:void(0);" and make the onclick event the first event listed for the link. Put the font tags outside the link, not inside it. Skip status=no, almost no browsers allow that live anymore. In fact, by simply specifying width and height, all those except resizable and possibly scrollbars default to no anyway. The event is onclick, not onClick.
Window name (red):
onclick="window.open('slides/03whatever.htm','500x333','width=500,he
As I say though, these measures won't overcome a really aggressive pop up blocker but, they will let you slip through in some cases where you otherwise would be blocked by less aggressive settings.
MattyBumBum
08-12-2006, 12:44 PM
Thanks again to ^you^ sir. Interesting stuff, even though I'm going for the DHTML opener I think. Is it generally better form to keep yer <font><b></b></font> type tags outside yer <a></a>'s then?
While we're on the subject of the window attributes (directories=no,status=no,menubar=no,toolbar=no,resizable=no) - how do you kill the message bar at the bottom? I guessed "msgbar=no" and was wrong.
jscheuer1
08-12-2006, 07:48 PM
The status=no would be it but, it doesn't work anymore due to security updates. Also, it is implied, so need not be listed - if any browser will allow it, simply not listing it will remove it from the pop up.
I'm not sure about the font tag, bold tag, etc. These really shouldn't be used anyway, as they have been deprecated in favor of css style. The issue here though, is that you need to make as direct of an association between the anchor tag's event and the link trigger as possible. The operative condition being 'user activated'. IE can be particularly finicky about this.
One thing I forgot to add is that you should also return false after your onclick event:
onclick="window.open('slides/03whatever.htm','mywin','width=500,height=333,scrollbars=no,resizable=no');return false;"
MattyBumBum
08-12-2006, 11:08 PM
Continued thanks sir.
So forgive me, indulge me, I'd really like to understand this stuff rather than just use it badly and hope to get away with it.
(i) How come status=no works locally? The message bar gets whipped off no trouble when I'm testing. How does my IE5 know the difference? It seems quite unfriendly to have taken such innocent choice away. (At least, I was going to use it innocently, purely aesthetically.)
(ii) On what level does this case-sensitivity onClick / onclick matter? How wide and far? I've nabbed bits and pieces of code from all over the place, so there are <SCRIPT>s and things knocking about. Does onmouseover work?
Sorry, too many little questionlets. I don't mean to take too much of your time, terse nutshells will do. ;)
(i) How come status=no works locally? The message bar gets whipped off no trouble when I'm testing. How does my IE5 know the difference? It seems quite unfriendly to have taken such innocent choice away. (At least, I was going to use it innocently, purely aesthetically.)I'm sure you have the best intentions in the world, but alas, the browser cannot know this :) Only local files are trusted completely, and even then they aren't allowed to connect to the Internet lest they "phone home," as it were.
(ii) On what level does this case-sensitivity onClick / onclick matter? How wide and far? I've nabbed bits and pieces of code from all over the place, so there are <SCRIPT>s and things knocking about. Does onmouseover work?HTML is case-insensitive. However, it's generally considered good style to use all-lower-case, especially since XHTML is not, and it will make updating the site to XHTML easier should that ever become feasible (http://www.hixie.ch/advocacy/xhtml). Also, the DOM event is called "onclick", and the DOM (and Javascript) is case-sensitive. Thus, element.onclick will function in Javascript, while element.onClick will not, and using the same case for both the HTML attribute and the DOM property helps to avoid confusion.
MattyBumBum
08-12-2006, 11:46 PM
Hmm, interesting. And not a little scary, that link. Thanks.
Gosh, this place logs you out pretty sharpish when you wander off, don't it.
Gosh, this place logs you out pretty sharpish when you wander off, don't it.It has been commented on. I just use the auto-login feature. ;)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.