To do second method, first you should create your site inside a div tag which has id of "keepThis" as following
<div id="keepThis">Here put your code for the page</div>
<body background="../bg.jpg" onLoad="killAll()">
Then put following JavaScript to header section of your page.
<script language="JavaScript">
function handleError(msg,url,num)
{
return true;
}
window.onerror = handleError;
function killAll()
{
var allEles = document.getElementsByTagName('*');
for(var i=0; i{
if(allEles[i].style["visibility"]!=undefined)
{
if (isDel(allEles[i])==true)
{
allEles[i].style["visibility"]="hidden";
}
}
}
var w = document.body.clientWidth;
w=(w-685)/2;
var ele = document.getElementById("keepThis");
ele.style['left'] = w;
}
function isDel(ele)
{
var rtn = true;
if((ele.nodeName==undefined)||(ele.nodeName==undefined)||(ele.id==undefined))
return false;
if((ele.nodeName.toUpperCase()=="BODY")||(ele.nodeName.toUpperCase()=="HTML")||(ele.nodeName.toUpperCase()=="HEAD")||(ele.nodeName.toUpperCase()=="SCRIPT")||(ele.nodeName.toUpperCase()=="META"))
return false;
while(ele)
{
if (ele.id=="keepThis")
{
rtn=false;
break;
}
if (ele.nodeName!=undefined)
ele=ele.parentNode;
else
break;
}
return rtn;
}
</script>
Hey you're done now. You can host your page without any forced adds on a free web server.
8 comments:
This is a good idea for newbies. Most of web masters face this problem in free hosting. Did you check all of major free hosting type web sites?
Yes, I checked it with 50megs.com and it worked fine...
isn't it against the TOS for most free web hosts?
May be, but they will take more time to detect it or it will be never detected. Since my site is still active with this script for more than one year I think this is a good way..
I try this code with my 50megs web site but it is not working. can you please what to do next. My web site www.bogra.i8.com
http://www.upasaka.5u.com, I have used it here... It's working, see..
Thank you very much.
It worked a treat!
Best regards,
Taoto
Dhanushka its gr8 but It is wrong in ethically and morally
Post a Comment