2

We are now developing a web site, we have some image link by outside source, like

<img class="comp_img" src="http://media-cdn......" />

it will be blocked, and add some attributions into <img> tag like

style="display: none !important; visibility: hidden !important; opacity: 0 !important; background-position: 0px 400px;"

I'm sure it's not AD, can I re-showing images by javascript? My javascript may like..

function showAdblockImage() {
    //get all google ad elements
    var adsList = document.querySelectorAll(".comp_img");
    if (!adsList) { return; }
    for (var i = 0; i < adsList.length; i++) {
        if (adsList[i].innerHTML.replace('/\s/g', "").length != 0) {
            //AdBlock is not active, hence exit
            break;
        }
        //apply inline css to force display
        adsList[i].style.cssText = '';
    }
}

enter image description here

enter image description here

Steven Chou
  • 1,504
  • 2
  • 21
  • 43
  • 1
    do you have an example, that we can check? – Jeremy Rajan Jan 12 '16 at 05:48
  • 1
    @JeremyRajan What's example ? the image link ? – Steven Chou Jan 12 '16 at 05:49
  • this image url will be blocked. http://media-cdn.tripadvisor.com/media/photo-s/02/d7/35/ea/the-sandbox-interactive.jpg – Steven Chou Jan 12 '16 at 05:50
  • 1
    as in, a screenshot of your screen on how it is blocked. Is it blocked in a resource way (which every adblocker does) or they are made hidden? To, see what is happening on your screen... – Jeremy Rajan Jan 12 '16 at 05:53
  • I added it, please see my content. – Steven Chou Jan 12 '16 at 06:00
  • Why do you even bother? Clients decided to mess with their pages, just let them do it. – zerkms Jan 12 '16 at 06:00
  • @zerkms I think my boss would not accept this answer – Steven Chou Jan 12 '16 at 06:02
  • 2
    Irregardless of how your boss wants that - you cannot do anything: if a client's browser for some reason wants to discard loading an image - it will. Learn being professional, your job is to explain how the web works. – zerkms Jan 12 '16 at 06:04
  • remove the add block plus extension /plugin if you are using it. – Punit Gajjar Jan 12 '16 at 06:05
  • 1
    If I were in your situation I would proxy blocked images. – Rango Jan 12 '16 at 06:51
  • 1
    ads might be blocked by image's SRC but also image's container (div, span, etc), status and attributes (class names, style, parent/child elements), could you send the complete HTML, just dump it somewhere (pastebin) and we could check what rule in the most common AdBlock list is targeting those ads, than you can rewrite some 'ignore rules' (`@@......`) and add them to your local-installation of AdBlock, unblocking worldwide will probably be a fail attempt, so you better give up right now, also- everyone hate ads!!! –  Jan 17 '16 at 09:55

0 Answers0