如何打开主窗口后面的弹出窗口(HTML,jQuery)



我是新来的。我有一个弹出代码,当用户单击 HTML 页面中的任意位置时,会出现一个弹出窗口:

(function () {
    document.onclick = function () {
        var sUrl = "http://URL.com";
        if (typeof daily_capping == "undefined") var daily_capping = 10;
        if (typeof capping_minutes == "undefined") var capping_minutes = 60;
        if (document.cookie.indexOf("_popwin=") === -1) {
            var ads2day = document.cookie.split("_popwinDaily=")[1];
            ads2day = typeof ads2day == "undefined" ? 0 : parseInt(ads2day.split(";")[0]);
            if (ads2day < daily_capping) {
                var isMSIE = navigator.userAgent.indexOf("MSIE") != -1 ? !0 : !1,
                    _parent = self,
                    sOptions, popunder;
                if (top != self) try {
                    top.document.location.toString() && (_parent = top)
                } catch (err) {}
                sOptions = "toolbar=no,scrollbars=yes,location=yes,statusbar=yes,menubar=no,resizable=1,width=" + screen.width.toString() + ",height=" + (screen.height - 20).toString() + ",screenX=0,screenY=0,left=0,top=0", popunder = _parent.window.open(sUrl, "rhpop", sOptions);
                if (popunder) {
                    popunder.blur();
                    if (isMSIE) {
                        window.focus();
                        try {
                            opener.window.focus()
                        } catch (err) {}
                    } else popunder.init = function (e) {
                        with(e)(function () {
                            if (typeof window.mozPaintCount != "undefined" || typeof navigator.webkitGetUserMedia == "function") {
                                var e = window.open("about:blank");
                                e.close()
                            }
                            try {
                                opener.window.focus()
                            } catch (t) {}
                        })()
                    }, popunder.params = {
                        url: sUrl
                    }, popunder.init(popunder)
                }
                var now = new Date,
                    popDaily = (new Date(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 23, 59, 59)).toGMTString();
                document.cookie = "_popwinDaily=" + (ads2day + 1) + ";expires=" + popDaily + ";path=/";
                var popInterval = new Date;
                popInterval.setTime(popInterval.getTime() + capping_minutes * 60 * 1e3), document.cookie = "_popwin=1;expires=" + popInterval.toGMTString() + ";path=/"
            }
        }
    }
})();

但是弹出窗口在顶部。 是否可以使其在主页后面打开?有没有更轻的弹出代码用于此目的?谢谢大家

你绝对不应该这样做。弹出广告具有侵入性和烦人性。在窗户下面偷偷打开弹出的窗户更脏。

如果您不想打扰用户,请不要为您的广告使用任何类型的弹出窗口。

或者,您也可以在现有网页中以内嵌方式展示广告。

无论如何,像这样的弹出窗口很可能会被现代浏览器挡住。它们被阻止的原因是因为用户不想看到这种操作,这可能很危险。

不要制作隐藏的弹出广告。

最新更新