To prevent the shielding, sound projection ad code



The principle of projection is for advertising, and no difficulty, no more than open windows loses focus (blur), are the focus of the original page (focus).But the popular browser, if pop-ups non-user behavior (ie onload, the direct window.open), the browser will be blocked by default.
Projection advertising, since known as the ads, how to get advertisers it for money, happy to spend it?

We can increase the judge, if the browser pop-up window is blocked, as long as the user clicks on the page to trigger the window.open event, this is generally not blocked, the browser will think it is the user's default behavior.

Code can be written as follows:
var $ E = YAHOO.util.Event;
var adPopup;
var popAd = function (sURL, sName, sFeatures, bReplace) {
if (adPopup) return;
if (sName == undefined) {
sName = '_blank';
};
if (sFeatures == undefined) {
sFeatures ='';
};
if (bReplace == undefined) {
bReplace = false;
};
adPopup = window.open (sURL, sTarget, sFeatures, bReplace);
adPopup.blur ();
adPopup.opener.focus ();
$ E.removeListener (document.body, 'click', arguments.callee);
}
try {
popAd ();
} Catch (e) {
$ E.on (document.body, 'click', popAd);
}
Of course, if the user's browser plug-ins installed the block, it likely will not pop up (such as Firefox, noscript plug-ins to allow any pop-up window.)Method is not absolute, is not the best, but with the least time to do things most efficiently.

PS: analog form can be submitted by way of pop-up window, through sex (as opposed to general interceptor missile window plugin) very good, but can not set the parameters of the content sFeatures