如何从我的网站上显示删除JoinPouch Pop-Ups

时间:2017-11-13 15:21:41

标签: javascript

扩展程序在我的网站上显示内容,我想使用JavaScript阻止它。有没有人知道如何阻止这些div类被创建?

1 个答案:

答案 0 :(得分:0)

试用此代码:

function Init () {
        var body = document.body;

        if (body.addEventListener) {
            body.addEventListener ('DOMNodeInsertedIntoDocument', OnNodeInsertedIntoDocument, false);
        }
    }

    function OnNodeInsertedIntoDocument () {
        var elements = ["mainPouchDiv", "pouchNotifyHeader", "nsPouchCrossPromotionContainer"];
        var element = null;
        var i = 0;

        for (i = 0; i < elements.length; i++) {
            element = document.getElementById(elements[i]);

            if (element) {
                document.body.removeChild(element);
                element = null;
            }
        }
    }