【问题标题】:How to disable Aweber popup on certain pages如何在某些页面上禁用 Aweber 弹出窗口
【发布时间】:2014-12-20 23:26:30
【问题描述】:

我有一个使用 Aweber 灯箱弹出窗口的 WP 网站,如下所示:

<div class="AW-Form-627359006"></div>
<script type="text/javascript">(function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = "http://forms.aweber.com/form/06/627359006.js";
    fjs.parentNode.insertBefore(js, fjs);
    }(document, "script", "aweber-wjs-zf6rn7szi"));
</script>

一切正常,但我正在向网站添加一些新内容,这些内容都将位于特定子目录中,并且我不希望灯箱显示任何这些页面。换句话说,任何以“www.mysite.com/directoryName/”开头的页面都不应显示灯箱。有什么建议吗?

谢谢!

【问题讨论】:

    标签: wordpress aweber


    【解决方案1】:

    您可以使用window.location.pathname。 示例:

    <div class="AW-Form-627359006"></div>
    <script type="text/javascript">
        if(window.location.pathname.split('/')[1] != 'directoryName') {
            (function(d, s, id) {
            var js, fjs = d.getElementsByTagName(s)[0];
            if (d.getElementById(id)) return;
            js = d.createElement(s); js.id = id;
            js.src = "http://forms.aweber.com/form/06/627359006.js";
            fjs.parentNode.insertBefore(js, fjs);
            }(document, "script", "aweber-wjs-zf6rn7szi"));
        }
    </script>
    

    【讨论】:

    • 就是这样(除了将 == 更改为 != 因为我不希望它显示在该目录中)。谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-02
    • 1970-01-01
    • 2018-12-18
    • 1970-01-01
    • 2019-02-08
    • 2021-08-09
    • 2019-12-01
    相关资源
    最近更新 更多