Back projection advertising code [JS]

Source: Internet
Author: User
Tags window
js| AD Code | back-Projection AD

There is no difficulty in the principle of back-pitching advertising, but the open window loses focus (blur), and the original page gets focus. But for the popular browser, if the non-User Behavior pop-up window (that is, onload, direct window.open), will be blocked by the browser default.

Back to advertising, since it is called advertising, then how to let advertisers spend the money is really willing to spend it?

We can increase the judgment, if the pop-up window is blocked by the browser, so long as the user clicks on the page to trigger the window.open event, so generally will not intercept, the browser will think that this is 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 a blocking plugin installed, it will probably not pop up (such as Firefox's NoScript plugin, do not allow any pop-up window). The method is not absolute, is not the best, but with the least amount of time to do the most efficient things.



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.