It looks like you're using an Ad Blocker.

Please white-list or disable AboveTopSecret.com in your ad-blocking tool.

Thank you.

 

Some features of ATS will be disabled while you continue to use an ad-blocker.

 

Alternating homepages?

page: 1
0

log in

join
share:

posted on Mar, 3 2005 @ 01:10 PM
link   
Does anyone know if its possible to have alternating homepages?




posted on Mar, 3 2005 @ 01:29 PM
link   
You could probably do a random home page with Javascript.
Use the following code for your "index.html" page.



< html >
<head>
<script type="text/_javascript">
<!--
function RandomPage()[
loadPage[0] = "http://www.mydomain.com/index1.htm";
loadPage[1] = "http://www.mydomain.com/index2.htm";
loadPage[2] = "http://www.mydomain.com/index3.htm";
index = Math.floor(Math.random() * loadPage.length);
document.location = loadPage[index];
]
//-->
</script>
</head>
<body ="setTimeout(RandomPage()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect!</p>

</body>
</html>


Change the setTimeout time to "0" for an instant redirect.

If you want it to alternate everyother time exactly you''ll have to use a serverside script like php (my favorite)


[edit on 3-3-2005 by dbates]



posted on Apr, 12 2005 @ 10:17 PM
link   
That's awesome code dbates.. I thought I'd take it a bit further by blocking a search bot from reading it.. some engines don't like JS in pages, so it might be handy for anyone using JS in their pages.

Create a new directory and call it code (or anything you like) and save the code dbates made as a alternate.js file in notepad. Modify this HTML in your < head> tags on your index page:

< script type="text/_javascript" "_javascript" "/code/alternate .js">


Now paste this code into notepad and save as robots.txt
robots.txt
User-agent: *
Disallow: /code/

This will block all search engines from reading anything in the code folder and made the page load faster.

[edit on 12-4-2005 by mickmeaney]

[edit on 12-4-2005 by mickmeaney]



posted on Apr, 18 2005 @ 08:52 PM
link   
Interesting insight. I usually don't bother doing anyting for search engines, but then I only tinker with web pages on the side. Useful information for sure.



new topics

 
0

log in

join