View Full Version : Web page re-directing

Oct 28, 2003, 11:39 PM
Here's the deal. I have a website on my ISP server. I am also developing a website on my Mac (PHP, MySQL and unlimited storage all come free...). What I would like to do is redirect the wabsite to my Mac *if* my Mac is turned on, ie get the index page to ping my IP a re-direct if possible. If my Mac is not connected I would like the index page to redirect itself to a page on my ISP server.

Is there a way of doing this. Javascript would the best as it's the only scripting language supported by my ISP. I am a complete beginner with JScript but willing to get my hands "dirty".

Thanks for you help :)

Oct 29, 2003, 12:39 AM
Here's a pretty easy method.

On the mac, have a file called something like redirectHere.js

it should have something like:

--- START CODE----
function comeHere(){
location.replace(<your server location>);

then on the isp you have your normal html page and modify like this:

---- START CODE---
<script src="<mac server>/redirecthere.js">
<body onLoad="comeHere()">
---- END CODE---

When the mac is up it will get the javascript from the mac and redirect there.
When it is not running it will not be able to get the javascript so will not redirect.

You should also put no caching directives so that the redirection page is not cached.

That should do it,

Oct 29, 2003, 02:35 AM
Just to let you guys know, there's a dedicated forum for web design discussion. :)

Oct 29, 2003, 09:08 AM
Originally posted by Rower_CPU
Just to let you guys know, there's a dedicated forum for web design discussion. :)

Oooooops. My Bad :)

Thanks ehwizard, I'll see if that works.

ok, I've tried and basically the JScript isn't loading into the page. It stays as a plain URL between the quotes.
What am I doing wrong?