Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: phranque
Why do you care if it gets blocked? You don't like pop-ups
Next time please add some value to your post.
You have to make it user initiated. Meaning, the user has to click on something to make it open. If you just pop up a window without a user performing an action, those are the culprits that blockers feed on. Just about every blocker I've seen/used does a good job of letting user initiated clicks happen.
<a href="url" onClick="window.open('url','title','features'); return false;">
Fully valid and, most importantly, does annoy a user with JS disabled by making an end run around his settings. If the user has JS enabled and your popup doesn't get blocked, it runs the JS and opens the new window and returns false, so it basically cancels the click and the current page stays the same.
If the user has JS disabled, then it doesn't run the code that returns false, treats the click as a normal click and opens the "popup" as a regular page (which is what the user wants - that's why he's disabled JS).
If JS is enabled but the popup gets blocked, it still returns false and nothing happens, though in general, in Firefox at least, the popup will open (user-initiated) and if it doesn't, the user will get a notice asking if he wishes to make an exception for your excellent site.
- target="_blank" forces a client to open a new window.
- opening a new window is a client-side behavior that should be achieved with client-side scripting that can be controlled by the client (or user of the client) if desired.
- using HTML to do this mixes models and overrides client controls.
It is the rough equivalent of using HTML to control font size and font face, rather than CSS, but I think worse, actually, because it doesn't merely force a presentation on the user regardless of whether they have an overriding stylesheet, but actually forces a behavior on the user for which no current browser offers an override.