Javascript Advertising Code

Source: Internet
Author: User

Since advertising is called advertising, how can we make Advertisers spend money and enjoy it?

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 the page. This will not be blocked, and the browser will think this is the default behavior of the user.

The code can be written as follows:
Copy codeThe 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 installed the interception plug-in, it is likely that it will not pop up (for example, the Firefox noscript plug-in will not allow any pop-up window ). The method is neither absolute nor optimal, but the most efficient thing is done with the least time.

PS: The window can be displayed by simulating form submission. The traversal is good (compared with the plug-in of the general interception window), but the content of the sFeatures parameter cannot be set.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.