I’m new to JS and I was wondering how to achieve the following: I need to remove an annoying ad which my hosting provider adds to the page, as a link to js script. It looks [URL=”http://img.ugu.pl/advert.js”]like this[/URL]. I’m thinking that I could add another script which would hide layers/iframes which the first one added. Problem is that they don’t have any IDs. Any ideas?
@aj_nscFeb 19.2010 — #Use Firefox and the webdeveloper toolbar add on to "View generated source" and then find out exactly where this div is in the DOM. Then just using DOM traversing techniques to get to that element and remove it. This must be done by a script which uses a setInterval (check every 10-100ms to see if the ad node is present) or setTimeout (run a function after a couple of seconds) after pageload to make sure the script which the host adds to the page has enough time to load and create the add.
HOWEVER, it's very very very very likely that doing this would constitute a violation of your hosts TOS and if you do this you will eventually get reprimanded/removed from their service.
If this is a free host, then cough up the dough if you want a page without advertising, if this is a paid host, then get a new host, they shouldn't be putting advertising on your site anyway so tell them to stop or you'll switch hosts (that might allow them to make an exception in your case) or just plain switch hosts (I know a couple of fantastic ones in terms and price AND service, if you're interested).