Since rear-projection advertisements are called advertisements, how can advertisers spend their money effectively and happily?
We can add judgment. If the pop-up window is intercepted by the browser, the window.open event will be triggered as long as the user clicks on the page. In this way, it will generally not be intercepted and the browser will consider this to be the user's default behavior.
The 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 has an interception plug-in installed, it is very likely that it will not Will pop up (for example, Firefox's noscript plug-in does not allow any pop-up windows). The method is not absolute, nor is it the best, it just uses the least time to do the most efficient thing.
PS: You can pop up the window by simulating form submission. The traversability (compared to the general plug-in that intercepts pop-up windows) is very good, but the sFeatures parameter content cannot be set