Home > Web Front-end > JS Tutorial > body text

Improvement of javascript pop-under advertising code_page background

WBOY
Release: 2016-05-16 19:05:26
Original
1343 people have browsed it

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:

Copy the code The code is 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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template