Actually, there is no way for your hosting to ensure that you cannot close its advertisements (advs.)!
Because of the fact that all the advs. are based on JavaScript and html, everyone can close them just by looking at their code behavior.
These are some methods:
1. (Easy level) some hosts add the advs. after your html codes which can be closed easily by adding some tags such as:
<noscript> , <embed>, <object>, <!–, <script>, and …
at the end of your html page. For instance:
I tested it in GoDaddy free web hosting by adding <noscript> tag and it works successfully: [http://www.plaincipher.com/welcome.html] (6 Jan. 2009) see its source code for more details.
However, hosting can neutralize this way easily by adding some close tags before starting its advs. such as:
</noscript>, </embed>, </object>, –>, </script>, and …
2. (Medium level) some host’s advertisements can be closed by calling their close function in their JavaScript. For instance I tested this code:
<script>document.getElementById(‘divADV’).style.visible=’hidden’;window.setInterval(‘closeWindow()’,0);closeWindow();</script>
at PersianBlog.ir’s weblogs and it works successfully: see [error404.persianblog.ir] (6 Jan. 2009).
3. (Hard level) some host’s advs. are very complicated in code, but they can also be closed by some tricks in neutralizing their frames and their JavaScript functions! I will write about some tricks after finishing this part.
For instance I tested this code:
<script language=”JavaScript”>
var settelingTime = 100;
var check4closing = 4;
function testjavascript()
{
window.setTimeout(“testjavascript()”, settelingTime);
if(top.d.getElementById(“FR”) && check4closing!=0){
if(check4closing==1)
alert(‘Bye yahoo advertisement! my new homepage is: soroush.secproject.com\nI will write there after that.’);
eval(‘top.d.getElementById(“FR”).setAttribute(“cols”,”*,0,0″);’);
check4closing–;
settelingTime = 1000;
}
}
</script>
at GeoCities.com and it works successfully: see [http://geocities.com/irsdl/blog/](6 Jan. 2009).
Now these are some techniques which I use them in neutralizing the JavaScript’s codes:
1. Make a function with the same name of advertisement’s function to change its behavior and overwrite it!
2. Change value of JavaScript’s global variables if they are important for advs.
2. Using some Ajax methods to find and replace some html tags by my new parameters.
3. Using some recursive loops too neutralize the advs. function during the time.
4. Using some XSS methods to do some magic such as: true=false!
I think you can find your methods to close the advs. too ;)
BTW, do not forget my copyright rules. Thank you very much :)