Even if the internet is growing and evolving with each day not all ISPs grow and evolve with it. There are still many users having low internet connections (like dial-up) and often they are forced to turn off images and other features so their browser won’t take ages to load one heavy page.
If you have a heavy website with loads of images and content is always better to think about those that have low internet connections too. You can do that by creating an other, more accessible version of your website, just for them. If you care enough for Search Engine Optimization then you’ll have block the robots to access/index/archive the content of this new version so you’ll not be penalized or banned from Search Engines index.
Now, if you have set up that low version of your website you’ll have to think to a way to find out who has a low internet connection so you can redirect them accordingly. Well, there are two ways of doing this:
- using server-side code
- or using client-side code
For this example I’ll be using JavaScript (client-side code) and all you need is just a few lines of code:
- first script included in the page header
- and the second one at the end of your page content
The first script should be added right under the beginning of your page header (right after the <head> start tag) so it can be read and interpreted as fast as possible.
<head>
<script type=”text/javascript”>
var thisTimer = 0; // initialize a timer
var locationToRedirect = “http://google.com/”; // set the landing page
var timeToComplete = 30*1000; // Set the timeout.
alert(“Page has started loading. Starting the timer.”);
function redirectUser() {
alert(“Navigating away from this page.”);
clearTimeout(thisTimer);
return window.location.href = locationToRedirect;
}
// By default, the redirection function will be called after 30 seconds (30*1000)
thisTimer = setTimeout(“redirectUser()”, timeToComplete);
</script>
<title>Page redirection using javascript</title>
</head>
Now, the second part, at the end of your document (right before the closing of the body tag):
<body>
<div>
<p>Document content</p>
</div>
<script type=”text/javascript”>
alert(“You have reached the end of the document within the expected time.\n The timeout will be cleared.”);
clearTimeout(thisTimer);
</script>
</body>
In short, this scripts gives the browser a time frame of 30 seconds to completely load your page. If the browser cannot load the page within specified time, then you can consider that that user is having a low internet connection and you can safely redirect him to your low version of your website.
Popularity: 9% [?]




SEO MegaCorp news blog is dedicated to provide tips, tricks and latest news around the industry that one might miss. We're a SEO company which is based in India, which is dedicated only to serve the clients with thier full satisfaction...
No User Responded in " Page Redirection Using Javascript "
Leave A Reply Here