I have a site (forum.tdp4teambattle) and recently, I started getting ads in the footer. I looked in the footer and there is no code for the ad. I'm thinking they put it in another file and specified it to a certain div ID. What code in HTML or JavaScript can I use to hide the ad so others don't see it?
Here is the ad image: .gif it is 468x60 (maybe you can give me a code to block images of that specific size from showing up).
Edit, solved: if anybody was using "listbb.ru" or "getbb.ru", here is the solution. You'll need to view source on your index page and do CTRL+F. Search for "mix", or "market" or similar. You will see something along the lines of "mix_block_{identifier}". To remove it, you'll need to navigate to ACP>Styles>Templates>{Theme}>Overall_header.html> find
</head>
and before, enter:
<style>
#mix_block_1294937123 {
display: none;
}
</style>
I have a site (forum.tdp4teambattle.) and recently, I started getting ads in the footer. I looked in the footer and there is no code for the ad. I'm thinking they put it in another file and specified it to a certain div ID. What code in HTML or JavaScript can I use to hide the ad so others don't see it?
Here is the ad image: http://is.mixmarket.biz/images/um/95480.gif it is 468x60 (maybe you can give me a code to block images of that specific size from showing up).
Edit, solved: if anybody was using "listbb.ru" or "getbb.ru", here is the solution. You'll need to view source on your index page and do CTRL+F. Search for "mix", or "market" or similar. You will see something along the lines of "mix_block_{identifier}". To remove it, you'll need to navigate to ACP>Styles>Templates>{Theme}>Overall_header.html> find
</head>
and before, enter:
<style>
#mix_block_1294937123 {
display: none;
}
</style>
Share
Improve this question
edited Sep 4, 2016 at 20:51
halfer
20.4k19 gold badges109 silver badges202 bronze badges
asked Aug 31, 2016 at 3:30
MichaelMavMichaelMav
901 gold badge1 silver badge10 bronze badges
1
- 2 Using a free web host? I suggest you pay for hosting if you want to remove ads. – Adam Hopkins Commented Aug 31, 2016 at 3:35
3 Answers
Reset to default 3The answer above is wrong. For solving the ad's youself the chunk of code doing it is:
<table border="0" cellspacing="0" cellpadding="0">
<tbody><tr>
<td>
<div id="mix_block_1294937123"><div id="mix_block_1294937123_1016" style="width:468px;height:60px;position: relative;"><a href="http://ucl.mixmarket.biz/uni/clk.php?id=1294878201&zid=1294937123&s=9019&tt=08310735" target="blank"><img src="http://is.mixmarket.biz/images/um/95480.gif" width="468" height="60" border="0" alt=""></a></div><script type="text/javascript" src="http://udata.mixmarket.biz/uss/stat/?mid=1294887383&id=1294937123&tt=1472614515"></script><img src="http://mixmarket.biz/t.php?uid=1294929468&r=http%3A//stackoverflow./questions/39240278/block-ads-with-html-js&t=1472614515" width="1" height="1"></div>
<script type="text/javascript">
document.write('<scr' + 'ipt language="javascript" type="text/javascript" src="http://1294937123.us.mixmarket.biz/uni/us/1294937123/?div=mix_block_1294937123&r=' + escape(document.referrer) + '&rnd=' + Math.round(Math.random() * 100000) + '" charset="windows-1251"><' + '/scr' + 'ipt>');
</script><script language="javascript" type="text/javascript" src="http://1294937123.us.mixmarket.biz/uni/us/1294937123/?div=mix_block_1294937123&r=http%3A//stackoverflow./questions/39240278/block-ads-with-html-js&rnd=39740" charset="windows-1251"></script>
</td></tr></tbody></table>
So if you have access to the css pick a div and do
Display: none;
following code removes ads with undesired pictures and blocking elements that appear above the web page
(function removeAdvertisementAndBlockingElements () {
$('.inRek').remove();
$('.mgbox').remove();
Array.from(document.getElementsByTagName("img")).forEach(function (e) {
if (!e.src.includes(window.location.host)) {
e.remove()
}
});
Array.from(document.getElementsByTagName("div")).forEach(function (e) {
var currentZIndex = parseInt(document.defaultView.getComputedStyle(e, null).zIndex);
if (currentZIndex > 999) {
console.log(parseInt(currentZIndex));
e.remove()
}
});
})();
Most of the ads are from google ad word. So there are inserted into a page by javascript. If you want to remove all ads only by inspecting it manually and remove it.
The other thing what you can do is, to do an inspect element on the ad block by right-click and select the option inspect element in chrome that opens a small panel in the bottom section of your browser and set the block's CSS property (on right-hand side) as display:none;